-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow NullLogicalType given a PhysicalType (#302)
* Allow NullLogicalType given a PhysicalType * Add a unit test for Null logical type roundtrip * Only allow the null logical type for optional columns * Parametrize the unit test for Null logical type roundtrip Co-authored-by: Mark Sumner <msumner91@users.noreply.github.com> Co-authored-by: Adam Reeve <adreeve@gmail.com> Co-authored-by: Matthew Harward <mharward-gr@users.noreply.github.com>
- Loading branch information
1 parent
1519bc0
commit 911ef53
Showing
3 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using NUnit.Framework.Interfaces; | ||
using NUnit.Framework.Internal; | ||
using NUnit.Framework.Internal.Builders; | ||
|
||
namespace ParquetSharp.Test | ||
{ | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] | ||
internal sealed class TestCaseGenericAttribute : TestCaseAttribute, ITestBuilder | ||
{ | ||
public TestCaseGenericAttribute(params object[] arguments) | ||
: base(arguments) | ||
{ | ||
} | ||
|
||
public Type[] TypeArguments { get; set; } = null!; | ||
|
||
IEnumerable<TestMethod> ITestBuilder.BuildFrom(IMethodInfo method, NUnit.Framework.Internal.Test? suite) | ||
{ | ||
if (!method.IsGenericMethodDefinition) | ||
return base.BuildFrom(method, suite); | ||
|
||
if (TypeArguments == null || TypeArguments.Length != method.GetGenericArguments().Length) | ||
{ | ||
var parms = new TestCaseParameters {RunState = RunState.NotRunnable}; | ||
parms.Properties.Set("_SKIPREASON", $"{nameof(TypeArguments)} should have {method.GetGenericArguments().Length} elements"); | ||
return new[] {new NUnitTestCaseBuilder().BuildTestMethod(method, suite, parms)}; | ||
} | ||
|
||
var genMethod = method.MakeGenericMethod(TypeArguments); | ||
return base.BuildFrom(genMethod, suite); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters