From b600fab88797b8908ac3816075373fa673dea16b Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Sun, 9 Jun 2024 12:24:58 +0100 Subject: [PATCH] Fix treatment of optionals which are not in TestCaseData (#49) --- .github/workflows/dotnet.yaml | 1 + Consumer/TestCaseData.fs | 11 ++++++++--- TestRunner.Lib/TestFixture.fs | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yaml b/.github/workflows/dotnet.yaml index dea8316..6f3bf88 100644 --- a/.github/workflows/dotnet.yaml +++ b/.github/workflows/dotnet.yaml @@ -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 diff --git a/Consumer/TestCaseData.fs b/Consumer/TestCaseData.fs index 033b140..a9f6738 100644 --- a/Consumer/TestCaseData.fs +++ b/Consumer/TestCaseData.fs @@ -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 - [] - let ``Consume options`` (s : string option) : unit = s |> shouldEqual s + [] + let ``Consume options, TestCaseData`` (s : string option) : unit = s |> shouldEqual s + + let optionalRaw = [ Some "hi" ; None ] + + [] + let ``Consume options, raw`` (s : string option) : unit = s |> shouldEqual s [] let tearDown () = diff --git a/TestRunner.Lib/TestFixture.fs b/TestRunner.Lib/TestFixture.fs index bbf3e67..9473e92 100644 --- a/TestRunner.Lib/TestFixture.fs +++ b/TestRunner.Lib/TestFixture.fs @@ -332,6 +332,7 @@ module TestFixture = yield Guid.NewGuid (), match arg with + | null -> [| (null : obj) |] | :? Tuple as (a, b) -> [| a ; b |] | :? Tuple as (a, b, c) -> [| a ; b ; c |] | :? Tuple as (a, b, c, d) -> [| a ; b ; c ; d |]