fix: CleanPath example + remove duplicate tests

CleanPath existed all along (path.go:118) — earlier grep had a stray
quote that hid it. Example now demonstrates actual behaviour:
redundant separator removal and .. resolution.

Removed duplicate CleanPath_Good test that conflicted with existing.

546 tests, all pass.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-03-25 18:34:39 +00:00
parent 8b905f3a4a
commit a2fa841772
2 changed files with 11 additions and 0 deletions

View file

@ -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
}

View file

@ -109,3 +109,4 @@ func TestPath_PathDir_TrailingSlash(t *testing.T) {
result := core.PathDir("/Users/snider/Code/")
assert.Equal(t, "/Users/snider/Code", result)
}