From bb63df8a2d2718e5547fcb9f78eaed47b639e1a9 Mon Sep 17 00:00:00 2001 From: Francesco Mecca Date: Thu, 5 Sep 2024 15:02:32 +0200 Subject: [PATCH] burroarachidi --- Makefile | 5 +++-- src/test_extensions.fs | 6 ++++++ tests/path_tests.fs | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 49ec52e..04990ef 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ test: dotnet test + test_reports: dotnet test --collect "XPlat Code Coverage" --results-directory /tmp/pentole_reports/ - mv /tmp/pentole_reports/*/coverage.cobertura.xml coverage.cobertura.xml - reportgenerator -targetdir:coverlet/reports -reporttypes:HtmlInline_AzurePipelines -repots:coverage.cobertura.xml + mv /tmp/pentole_reports/*/coverage.cobertura.xml . + reportgenerator -targetdir:coverlet/reports -reporttypes:HtmlInline_AzurePipelines -reports:coverage.cobertura.xml diff --git a/src/test_extensions.fs b/src/test_extensions.fs index e483d0f..f475f0d 100644 --- a/src/test_extensions.fs +++ b/src/test_extensions.fs @@ -9,6 +9,12 @@ type NUnit.Framework.Assert with | Ok got -> Assert.That (got, Is.EqualTo(expected)) | Error e -> Assert.Fail $"Expected 'ok, got: {e}" + static member is_true (got: bool) = + Assert.That (got, Is.True) + + static member is_false (got: bool) = + Assert.That (got, Is.False) + static member ok_is_true (r: Result) = match r with | Ok got -> Assert.That (got, Is.True) diff --git a/tests/path_tests.fs b/tests/path_tests.fs index 7a5c83f..0c2d22f 100644 --- a/tests/path_tests.fs +++ b/tests/path_tests.fs @@ -6,6 +6,10 @@ open Pentole.TestsExtensions open Pentole.Path open Pentole.Result +[] +let constructor_test () = + "/" |> Path.of_string |> Result.isOk |> Assert.is_true + '\000' |> string |> Path.of_string |> Result.isOk |> Assert.is_false [] let absolute_test () = let is_absolute = function