(t *testing.T)
| 18 | ) |
| 19 | |
| 20 | func TestWindowsPaths(t *testing.T) { |
| 21 | type testCase struct { |
| 22 | input string |
| 23 | expectedRoot string |
| 24 | expectedURI string |
| 25 | } |
| 26 | testCases := []testCase{ |
| 27 | {`e:`, `\\?\e:\`, `e:\`}, |
| 28 | {`e:\`, `\\?\e:\`, `e:\`}, |
| 29 | {`e:\\`, `\\?\e:\`, `e:\`}, |
| 30 | {`\\?\e:`, `\\?\e:\`, `e:\`}, |
| 31 | {`\\?\e:\`, `\\?\e:\`, `e:\`}, |
| 32 | {`\\?\e:\\`, `\\?\e:\`, `e:\`}, |
| 33 | {`e:\x`, `\\?\e:\x`, `e:\x`}, |
| 34 | {`e:\x\`, `\\?\e:\x`, `e:\x`}, |
| 35 | {`e:\x\\`, `\\?\e:\x`, `e:\x`}, |
| 36 | {`\\192.0.2.22\network\share`, `\\192.0.2.22\network\share`, `\\192.0.2.22\network\share`}, |
| 37 | } |
| 38 | |
| 39 | for i, testCase := range testCases { |
| 40 | fs := newBasicFilesystem(testCase.input) |
| 41 | if fs.root != testCase.expectedRoot { |
| 42 | t.Errorf("test %d: root: expected `%s`, got `%s`", i, testCase.expectedRoot, fs.root) |
| 43 | } |
| 44 | if fs.URI() != testCase.expectedURI { |
| 45 | t.Errorf("test %d: uri: expected `%s`, got `%s`", i, testCase.expectedURI, fs.URI()) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | fs := newBasicFilesystem(`relative\path`) |
| 50 | if fs.root == `relative\path` || !strings.HasPrefix(fs.root, "\\\\?\\") { |
| 51 | t.Errorf("%q == %q, expected absolutification", fs.root, `relative\path`) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | func TestResolveWindows83(t *testing.T) { |
| 56 | fs, dir := setup(t) |
nothing calls this directly
no test coverage detected