TestFilePath just ensures the slash normalization works as expected.
(t *testing.T)
| 850 | |
| 851 | // TestFilePath just ensures the slash normalization works as expected. |
| 852 | func 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. |
| 868 | func TestBreakIntoParts(t *testing.T) { |
nothing calls this directly
no test coverage detected