Compare commits

...

6 Commits

Author SHA1 Message Date
Patrick Stevens
eb4dfae8f4 Forbid generics (#55) 2024-06-10 12:18:33 +01:00
Patrick Stevens
78f51d127c Print path to TRX file (#54) 2024-06-10 12:16:16 +01:00
Patrick Stevens
3866823ccd Fix filter (#50) 2024-06-09 14:06:40 +01:00
Patrick Stevens
b600fab887 Fix treatment of optionals which are not in TestCaseData (#49) 2024-06-09 12:24:58 +01:00
Patrick Stevens
8dc23d5b38 Fix path to runtime (#48) 2024-06-09 12:19:29 +01:00
Patrick Stevens
fb9c041959 Continuous integration to true (#47) 2024-06-09 10:56:04 +01:00
6 changed files with 39 additions and 6 deletions

View File

@@ -74,6 +74,7 @@ jobs:
run: 'nix develop --command dotnet exec ./TestRunner/bin/Release/net8.0/TestRunner.dll ./Consumer/bin/Release/net8.0/Consumer.dll --trx TrxOut/out.trx'
- name: Parse Trx files
uses: NasAmin/trx-parser@v0.6.0
if: always()
id: trx-parser
with:
TRX_PATH: ${{ github.workspace }}/TrxOut

View File

@@ -25,10 +25,15 @@ module TestCaseData =
let ``Consume test data from multiple sources`` (i : int, s : string, arr : float[]) =
lock multipleSources (fun () -> multipleSources.Add (i, s, arr))
let optional = [ Some "hi" ; None ] |> List.map TestCaseData
let optionalData = [ Some "hi" ; None ] |> List.map TestCaseData
[<TestCaseSource(nameof optional)>]
let ``Consume options`` (s : string option) : unit = s |> shouldEqual s
[<TestCaseSource(nameof optionalData)>]
let ``Consume options, TestCaseData`` (s : string option) : unit = s |> shouldEqual s
let optionalRaw = [ Some "hi" ; None ]
[<TestCaseSource(nameof optionalRaw)>]
let ``Consume options, raw`` (s : string option) : unit = s |> shouldEqual s
[<OneTimeTearDown>]
let tearDown () =

View File

@@ -12,4 +12,7 @@
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.139" PrivateAssets="all"/>
</ItemGroup>
<PropertyGroup Condition="'$(GITHUB_ACTION)' != ''">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>

View File

@@ -291,9 +291,10 @@ module Filter =
fun a b -> inner1 a b || inner2 a b
| Filter.Name (Match.Exact m) -> fun _fixture method -> method.Method.Name = m
| Filter.Name (Match.Contains m) -> fun _fixture method -> method.Method.Name.Contains m
| Filter.FullyQualifiedName (Match.Exact m) -> fun fixture method -> (fixture.Name + method.Method.Name) = m
| Filter.FullyQualifiedName (Match.Exact m) ->
fun _fixture method -> (method.Method.DeclaringType.FullName + "." + method.Method.Name) = m
| Filter.FullyQualifiedName (Match.Contains m) ->
fun fixture method -> (fixture.Name + method.Method.Name).Contains m
fun _fixture method -> (method.Method.DeclaringType.FullName + "." + method.Method.Name).Contains m
| Filter.TestCategory (Match.Contains m) ->
fun _fixture method -> method.Categories |> List.exists (fun cat -> cat.Contains m)
| Filter.TestCategory (Match.Exact m) -> fun _fixture method -> method.Categories |> List.contains m

View File

@@ -230,6 +230,27 @@ module TestFixture =
(test : SingleTestMethod)
: (Result<TestMemberSuccess, TestMemberFailure> * IndividualTestRunMetadata) list
=
if test.Method.ContainsGenericParameters then
let failureMetadata =
{
Total = TimeSpan.Zero
Start = DateTimeOffset.Now
End = DateTimeOffset.Now
ComputerName = Environment.MachineName
ExecutionId = Guid.NewGuid ()
TestId = Guid.NewGuid ()
TestName = test.Name
ClassName = test.Method.DeclaringType.FullName
StdErr = None
StdOut = None
}
let error =
TestMemberFailure.Malformed [ "Test contained generic parameters; generics are not supported." ]
(Error error, failureMetadata) |> List.singleton
else
let resultPreRun =
(None, test.Modifiers)
||> List.fold (fun _result modifier ->
@@ -332,6 +353,7 @@ module TestFixture =
yield
Guid.NewGuid (),
match arg with
| null -> [| (null : obj) |]
| :? Tuple<obj, obj> as (a, b) -> [| a ; b |]
| :? Tuple<obj, obj, obj> as (a, b, c) -> [| a ; b ; c |]
| :? Tuple<obj, obj, obj, obj> as (a, b, c, d) -> [| a ; b ; c ; d |]

View File

@@ -133,7 +133,7 @@ module Program =
| None ->
// Keep on trucking: let's be optimistic and hope that we're self-contained.
[ dll.Directory ]
| Some (Choice1Of2 runtime) -> [ dll.Directory ; DirectoryInfo runtime.Path ]
| Some (Choice1Of2 runtime) -> [ dll.Directory ; DirectoryInfo $"%s{runtime.Path}/%s{runtime.Version}" ]
| Some (Choice2Of2 sdk) -> [ dll.Directory ; DirectoryInfo sdk.Path ]
let main argv =
@@ -401,6 +401,7 @@ module Program =
let contents = TrxReport.toXml report |> fun d -> d.OuterXml
trxPath.Directory.Create ()
File.WriteAllText (trxPath.FullName, contents)
Console.Error.WriteLine $"Written TRX file: %s{trxPath.FullName}"
| None -> ()
match outcome with