MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / TestFilePath

Function TestFilePath

internal/util/util_test.go:852–865  ·  view source on GitHub ↗

TestFilePath just ensures the slash normalization works as expected.

(t *testing.T)

Source from the content-addressed store, hash-verified

850
851// TestFilePath just ensures the slash normalization works as expected.
852func TestFilePath(t *testing.T) {
853 path := FilePath("foo", "bar")
854 // On POSIX, we'd expect "foobar". On Windows, it might differ in testing environment.
855 // But fromSlash will remove forward slashes and apply OS-specific.
856 // The best we can do here is confirm there's no slash if we're combining.
857 if !strings.Contains(path, string(os.PathSeparator)) && len(path) != 6 {
858 t.Errorf("FilePath('foo','bar') = %q, unexpected result", path)
859 }
860
861 single := FilePath("foo/bar")
862 if !strings.Contains(single, string(os.PathSeparator)) && len(single) == 7 {
863 t.Errorf("FilePath('foo/bar') = %q, expected slash replaced with OS separator", single)
864 }
865}
866
867// TestBreakIntoParts ensures we get progressively smaller strings.
868func TestBreakIntoParts(t *testing.T) {

Callers

nothing calls this directly

Calls 1

FilePathFunction · 0.85

Tested by

no test coverage detected