(t *testing.T)
| 126 | } |
| 127 | |
| 128 | func TestFileMatcherNonWindows(t *testing.T) { |
| 129 | if runtime.GOOS == "windows" { |
| 130 | return |
| 131 | } |
| 132 | |
| 133 | // this is impossible to test on Windows, but tests a security patch for other platforms |
| 134 | tc := testCase{ |
| 135 | path: "/foodir/secr%5Cet.txt", |
| 136 | expectedPath: "/foodir/secr\\et.txt", |
| 137 | expectedType: "file", |
| 138 | matched: true, |
| 139 | } |
| 140 | |
| 141 | f, err := os.Create(filepath.Join("testdata", strings.TrimPrefix(tc.expectedPath, "/"))) |
| 142 | if err != nil { |
| 143 | t.Fatalf("could not create test file: %v", err) |
| 144 | } |
| 145 | defer f.Close() |
| 146 | defer os.Remove(f.Name()) |
| 147 | |
| 148 | fileMatcherTest(t, 0, tc) |
| 149 | } |
| 150 | |
| 151 | func fileMatcherTest(t *testing.T, i int, tc testCase) { |
| 152 | m := &MatchFile{ |
nothing calls this directly
no test coverage detected