MCPcopy Index your code
hub / github.com/syncthing/syncthing / TestWindowsPaths

Function TestWindowsPaths

lib/fs/basicfs_windows_test.go:20–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func 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
55func TestResolveWindows83(t *testing.T) {
56 fs, dir := setup(t)

Callers

nothing calls this directly

Calls 2

newBasicFilesystemFunction · 0.85
URIMethod · 0.65

Tested by

no test coverage detected