diff --git a/Makefile b/Makefile index 04990ef..1fde9ad 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,10 @@ test_reports: dotnet test --collect "XPlat Code Coverage" --results-directory /tmp/pentole_reports/ mv /tmp/pentole_reports/*/coverage.cobertura.xml . reportgenerator -targetdir:coverlet/reports -reporttypes:HtmlInline_AzurePipelines -reports:coverage.cobertura.xml + + +clean: + rm Pentole/bin Pentole/obj tests/bin tests/obj -fr + +docs: test + fsdocs build --output pentole diff --git a/Pentole/Pentole.fsproj b/Pentole/Pentole.fsproj index a16b241..c4ba52d 100644 --- a/Pentole/Pentole.fsproj +++ b/Pentole/Pentole.fsproj @@ -4,12 +4,13 @@ net8.0 true Pentole - 0.0.1 + 0.0.3 Francesco Mecca Bugless24 + @@ -22,6 +23,9 @@ + + + diff --git a/Pentole/native.fs b/Pentole/native.fs index 023cd89..570e700 100644 --- a/Pentole/native.fs +++ b/Pentole/native.fs @@ -16,7 +16,7 @@ let realpath (path: string) = if ptr = IntPtr.Zero then let errno = Marshal.GetLastWin32Error() let error = Marshal.PtrToStringAuto(_strerror errno) - Error $"realpath failed: {error} ({errno})" + Error $"realpath failed: {error} ({errno}), path={path}" else let result = Marshal.PtrToStringAuto ptr Marshal.FreeHGlobal ptr diff --git a/Pentole/path.fs b/Pentole/path.fs index c09feb8..030baa9 100644 --- a/Pentole/path.fs +++ b/Pentole/path.fs @@ -110,9 +110,9 @@ let is_normalized (path_: Path) = // impure functions // https://docs.python.org/3.8/library/pathlib.html - -let resolve = function - | Absolute path -> - Native.realpath path |> Result.map Path.of_string - | Relative path -> - Native.realpath path |> Result.map Path.of_string +module FileSystem = + let resolve = function + | Absolute path -> + Native.realpath path |> Result.bind Path.of_string + | Relative path -> + Native.realpath path |> Result.bind Path.of_string diff --git a/Pentole/pervasives.fs b/Pentole/pervasives.fs index 30e0128..4c74acd 100644 --- a/Pentole/pervasives.fs +++ b/Pentole/pervasives.fs @@ -3,14 +3,12 @@ module Pentole.Pervasives /// /// The identity function. /// -/// let identity = id /// /// 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 /// -/// let tee fun_ obj = fun_ obj obj diff --git a/tests/path_tests.fs b/tests/path_tests.fs index 0c2d22f..753e15c 100644 --- a/tests/path_tests.fs +++ b/tests/path_tests.fs @@ -41,7 +41,7 @@ let resolve_test () = let test (s:string) = s |> Path.of_string - |> Result.bind resolve + |> Result.map FileSystem.resolve |> Result.get let p (n: string ) = Path.of_string n |> Result.get