add makefile

This commit is contained in:
Francesco Mecca 2024-08-30 07:45:50 +02:00
parent 7cb325aab0
commit f3754356a1
5 changed files with 29 additions and 1 deletions

3
.gitignore vendored
View file

@ -3,6 +3,8 @@
## ##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
coverlet
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
@ -117,6 +119,7 @@ _TeamCity*
# Visual Studio code coverage results # Visual Studio code coverage results
*.coverage *.coverage
coverage.cobertura.xml
*.coveragexml *.coveragexml
# NCrunch # NCrunch

6
Makefile Normal file
View file

@ -0,0 +1,6 @@
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

16
src/pervasives.fs Normal file
View file

@ -0,0 +1,16 @@
module Pentole.Pervasives
/// <summary>
/// The identity function.
/// </summary>
/// <param name="x"></param>
let identity = id
/// <summary>
/// Pass the object to a function and return the object unchanged.
/// Useful in the middle of pipelines to see what values are being passed or log
/// </summary>
/// <xparam name="x"></param>
let tee fun_ obj =
fun_ obj
obj

View file

@ -6,6 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="pervasives.fs" />
<Compile Include="string.fs" /> <Compile Include="string.fs" />
<Compile Include="option.fs" /> <Compile Include="option.fs" />
<Compile Include="result.fs" /> <Compile Include="result.fs" />

View file

@ -38,6 +38,7 @@ let resolve_test () =
s s
|> Path.of_string |> Path.of_string
|> Result.bind resolve |> Result.bind resolve
|> Result.get
let p (n: string ) = Path.of_string n |> Result.get let p (n: string ) = Path.of_string n |> Result.get
"/" |> test |> Assert.ok_is_equal (p "/") "/" |> test |> Assert.ok_is_equal (p "/")
@ -48,7 +49,7 @@ let resolve_test () =
let equality_test () = let equality_test () =
let p (n: string ) = Path.of_string n |> Result.get let p (n: string ) = Path.of_string n |> Result.get
Assert.are_equal (p "/etc") (p "/etc/") Assert.are_equal (p "/etc") (p "/etc/")
(*
[<Test>] [<Test>]
let parent_test () = let parent_test () =
let p (n: string ) = Path.of_string n |> Result.get let p (n: string ) = Path.of_string n |> Result.get
@ -62,3 +63,4 @@ let parent_test () =
"/etc/" |> test |> Assert.are_seq_equal ["/"] "/etc/" |> test |> Assert.are_seq_equal ["/"]
"/etc/conf" |> test |> Assert.are_seq_equal [p "/etc"] "/etc/conf" |> test |> Assert.are_seq_equal [p "/etc"]
"/etc/../etc" |> test |> Assert.ok_is_equal (p "/etc") "/etc/../etc" |> test |> Assert.ok_is_equal (p "/etc")
*)