diff --git a/path_example_test.go b/path_example_test.go index e1ff81d..19c8cc8 100644 --- a/path_example_test.go +++ b/path_example_test.go @@ -26,3 +26,13 @@ func ExamplePathExt() { // Output: .pdf } +func ExampleCleanPath() { + fmt.Println(CleanPath("/tmp//file", "/")) + fmt.Println(CleanPath("a/b/../c", "/")) + fmt.Println(CleanPath("deploy/to/homelab", "/")) + // Output: + // /tmp/file + // a/c + // deploy/to/homelab +} + diff --git a/path_test.go b/path_test.go index 4e0f427..83858c3 100644 --- a/path_test.go +++ b/path_test.go @@ -109,3 +109,4 @@ func TestPath_PathDir_TrailingSlash(t *testing.T) { result := core.PathDir("/Users/snider/Code/") assert.Equal(t, "/Users/snider/Code", result) } +