(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestWindowsValidPath(t *testing.T) { |
| 10 | t.Parallel() |
| 11 | tests := []struct { |
| 12 | path string |
| 13 | want bool |
| 14 | }{ |
| 15 | {".git", true}, |
| 16 | {".git . . .", false}, |
| 17 | {".git ", false}, |
| 18 | {".git ", false}, |
| 19 | {".git . .", false}, |
| 20 | {".git . .", false}, |
| 21 | {".git::$INDEX_ALLOCATION", false}, |
| 22 | {".git:", false}, |
| 23 | {"git~1 ", false}, |
| 24 | {"git~1.", false}, |
| 25 | {"GIT~1 ", false}, |
| 26 | {"git~1::$DATA", false}, |
| 27 | {"CON", false}, |
| 28 | {"con", false}, |
| 29 | {"CON.txt", false}, |
| 30 | {"CON:ads", false}, |
| 31 | {"CON ", false}, |
| 32 | {"PRN", false}, |
| 33 | {"AUX", false}, |
| 34 | {"NUL", false}, |
| 35 | {"COM1", false}, |
| 36 | {"COM9", false}, |
| 37 | {"LPT1", false}, |
| 38 | {"LPT9", false}, |
| 39 | {"CONIN$", false}, |
| 40 | {"CONOUT$", false}, |
| 41 | {"a", true}, |
| 42 | {"a\\b", true}, |
| 43 | {"a/b", true}, |
| 44 | {".gitm", true}, |
| 45 | {"CONNECT", true}, |
| 46 | {"comic", true}, |
| 47 | {"COM", true}, |
| 48 | {"COM0", true}, |
| 49 | {"LPT0", true}, |
| 50 | // Bare ".git" / "git~1" stay valid here; the caller decides |
| 51 | // whether they are permissible at the current path position. |
| 52 | {".git", true}, |
| 53 | {"git~1", true}, |
| 54 | } |
| 55 | |
| 56 | for _, tc := range tests { |
| 57 | t.Run(tc.path, func(t *testing.T) { |
| 58 | t.Parallel() |
| 59 | got := WindowsValidPath(tc.path) |
| 60 | assert.Equal(t, tc.want, got) |
| 61 | }) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func TestIsNTFSDotGit(t *testing.T) { |
| 66 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…