Lines Matching refs:fs

30 func newFs() *fs.MockFs {
31 return fs.NewMockFs(map[string][]byte{})
34 func newFinder(t *testing.T, filesystem *fs.MockFs, cacheParams CacheParams) *Finder {
38 func newFinderWithNumThreads(t *testing.T, filesystem *fs.MockFs, cacheParams CacheParams, numThrea…
46 func newFinderAndErr(t *testing.T, filesystem *fs.MockFs, cacheParams CacheParams, numThreads int) …
84 fs.Create(t, filepath.Join(root, path), filesystem)
104 fs.AssertSameResponse(t, foundPaths, absoluteMatches)
155 fs.Create(t, filepath.Join(root, "findme.txt"), filesystem)
169 fs.AssertSameResponse(t, foundPaths, []string{})
178 fs.Create(t, createdPath, filesystem)
193 fs.AssertSameResponse(t, foundPaths, []string{createdPath})
201 fs.Create(t, "/tmp/findme.txt", filesystem)
219 fs.Create(t, "/tmp/exclude/findme.txt", filesystem)
220 fs.Create(t, "/tmp/exclude/subdir/findme.txt", filesystem)
221 fs.Create(t, "/tmp/subdir/exclude/findme.txt", filesystem)
222 fs.Create(t, "/tmp/subdir/subdir/findme.txt", filesystem)
223 fs.Create(t, "/tmp/subdir/findme.txt", filesystem)
224 fs.Create(t, "/tmp/findme.txt", filesystem)
239 fs.AssertSameResponse(t, foundPaths,
247 fs.Create(t, "/tmp/out/findme.txt", filesystem)
248 fs.Create(t, "/tmp/out/.ignore-out-dir", filesystem)
249 fs.Create(t, "/tmp/out/child/findme.txt", filesystem)
251 fs.Create(t, "/tmp/out2/.ignore-out-dir", filesystem)
252 fs.Create(t, "/tmp/out2/sub/findme.txt", filesystem)
254 fs.Create(t, "/tmp/findme.txt", filesystem)
255 fs.Create(t, "/tmp/include/findme.txt", filesystem)
270 fs.AssertSameResponse(t, foundPaths,
279 fs.Create(t, "/tmp/a/findme.txt", filesystem)
280 fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
281 fs.Create(t, "/tmp/b/findme.txt", filesystem)
282 fs.Create(t, "/tmp/b/subdir/findme.txt", filesystem)
296 fs.AssertSameResponse(t, foundPaths,
303 fs.Create(t, "/tmp/a/findme.txt", filesystem)
304 fs.Create(t, "/tmp/a/subdir/findme.txt", filesystem)
305 fs.Create(t, "/tmp/b/findme.txt", filesystem)
306 fs.Create(t, "/tmp/b/subdir/findme.txt", filesystem)
323 fs.AssertSameResponse(t, foundPaths, []string{})
331 fs.Create(t, "/tmp/findme.txt", filesystem)
332 fs.Create(t, "/tmp/a/findme.txt", filesystem)
333 fs.Create(t, "/tmp/a/misc.txt", filesystem)
350 fs.AssertSameResponse(t, foundPaths, []string{})
358 fs.Create(t, "/tmp/ignore/hi.txt", filesystem)
359 fs.Create(t, "/tmp/include/hi.txt", filesystem)
360 fs.Create(t, "/cwd/hi.txt", filesystem)
361 fs.Create(t, "/cwd/a/hi.txt", filesystem)
362 fs.Create(t, "/cwd/a/a/hi.txt", filesystem)
363 fs.Create(t, "/rel/a/hi.txt", filesystem)
376 fs.AssertSameResponse(t, foundPaths,
381 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/include/hi.txt"})
384 fs.AssertSameResponse(t, foundPaths,
390 fs.AssertSameResponse(t, foundPaths,
394 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/include/hi.txt"})
402 fs.Create(t, "/tmp/a/b/c/d/e/f/g/h/i/j/findme.txt", filesystem)
416 fs.AssertSameResponse(t, foundPaths,
422 fs.Create(t, "/tmp/a/hi.txt", filesystem)
423 fs.Create(t, "/tmp/b/hi.txt", filesystem)
424 fs.Create(t, "/tmp/b/a/hi.txt", filesystem)
438 fs.AssertSameResponse(t, foundPaths,
460 fs.Create(t, path, filesystem)
488 fs.AssertSameResponse(t, foundPaths, paths)
516 fs.Create(t, path, filesystem)
554 fs.AssertSameResponse(t, testRun.foundMatches, testRun.correctMatches)
561 fs.Create(t, "/tmp/findme.txt", filesystem)
562 fs.Create(t, "/tmp/a/findme.txt", filesystem)
563 fs.Create(t, "/tmp/b/findme.txt", filesystem)
577 fs.AssertSameResponse(t, foundPaths,
586 fs.Create(t, "/tmp/findme.txt", filesystem)
587 fs.Create(t, "/tmp/a/findme.txt", filesystem)
588 fs.Write(t, "/finder/finder-db", "sample header", filesystem)
602 fs.AssertSameResponse(t, foundPaths,
610 fs.Create(t, "/tmp/findme.txt", filesystem)
611 fs.Create(t, "/tmp/a/findme.txt", filesystem)
626 fs.AssertSameResponse(t, foundPaths, correctResponse)
630 cacheText := fs.Read(t, finder.DbPath, filesystem)
647 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
648 fs.AssertSameReadDirCalls(t, filesystem.StatCalls, statCalls)
656 fs.Create(t, "/tmp/findme.txt", filesystem)
657 fs.Create(t, "/tmp/a/findme.txt", filesystem)
674 fs.AssertSameResponse(t, foundPaths, correctResponse)
695 fs.AssertSameResponse(t, foundPaths, correctResponse)
720 fs.Create(t, "/tmp/a/findme.txt", filesystem)
735 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt"})
736 fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{"/tmp", "/tmp/a"})
737 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/a"})
743 fs.Create(t, "/tmp/ignoreme.txt", filesystem)
744 fs.Create(t, "/tmp/a/findme.txt", filesystem)
745 fs.Create(t, "/tmp/b/ignore.txt", filesystem)
746 fs.Create(t, "/tmp/b/c/nope.txt", filesystem)
747 fs.Create(t, "/tmp/b/c/d/irrelevant.txt", filesystem)
762 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt"})
766 fs.Create(t, "/tmp/b/c/findme.txt", filesystem)
775 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt", "/tmp/b/c/findme.txt"})
776fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{"/tmp", "/tmp/a", "/tmp/b", "/tmp/b/c", "…
777 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b/c"})
785 fs.Create(t, "/tmp/ignoreme.txt", filesystem)
786 fs.Create(t, "/tmp/a/findme.txt", filesystem)
787 fs.Create(t, "/tmp/b/ignore.txt", filesystem)
788 fs.Create(t, "/tmp/b/c/nope.txt", filesystem)
789 fs.Create(t, "/tmp/b/c/d/irrelevant.txt", filesystem)
803 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt"})
807 fs.Create(t, "/tmp/b/c/new/findme.txt", filesystem)
808 fs.Create(t, "/tmp/b/c/new/new2/findme.txt", filesystem)
809 fs.Create(t, "/tmp/b/c/new/new2/ignoreme.txt", filesystem)
817 fs.AssertSameResponse(t, foundPaths,
819 fs.AssertSameStatCalls(t, filesystem.StatCalls,
821fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b/c", "/tmp/b/c/new", "/tmp/b…
829 fs.Create(t, "/tmp/hi1.txt", filesystem)
830 fs.Create(t, "/tmp/a/hi1.txt", filesystem)
844 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/hi1.txt", "/tmp/a/hi1.txt"})
848 fs.Create(t, "/tmp/hi2.txt", filesystem)
849 fs.Create(t, "/tmp/a/hi2.txt", filesystem)
857 fs.AssertSameResponse(t, foundPaths,
859 fs.AssertSameStatCalls(t, filesystem.StatCalls,
861 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/a"})
869 fs.Create(t, "/tmp/ignoreme.txt", filesystem)
870 fs.Create(t, "/tmp/a/findme.txt", filesystem)
871 fs.Create(t, "/tmp/b/findme.txt", filesystem)
872 fs.Create(t, "/tmp/b/c/nope.txt", filesystem)
873 fs.Create(t, "/tmp/b/c/d/irrelevant.txt", filesystem)
887 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt", "/tmp/b/findme.txt"})
891 fs.Delete(t, "/tmp/b/findme.txt", filesystem)
899 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt"})
900fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{"/tmp", "/tmp/a", "/tmp/b", "/tmp/b/c", "…
901 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b"})
909 fs.Create(t, "/tmp/findme.txt", filesystem)
910 fs.Create(t, "/tmp/a/findme.txt", filesystem)
911 fs.Create(t, "/tmp/a/1/findme.txt", filesystem)
912 fs.Create(t, "/tmp/a/1/2/findme.txt", filesystem)
913 fs.Create(t, "/tmp/b/findme.txt", filesystem)
927 fs.AssertSameResponse(t, foundPaths,
936 fs.RemoveAll(t, "/tmp/a/1", filesystem)
944 fs.AssertSameResponse(t, foundPaths,
954 fs.AssertSameStatCalls(t, filesystem.StatCalls,
956 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/a"})
964 fs.Create(t, "/tmp/findme.txt", filesystem)
965 fs.Create(t, "/tmp/a/findme.txt", filesystem)
966 fs.Create(t, "/tmp/a/1/findme.txt", filesystem)
967 fs.Create(t, "/tmp/a/1/2/findme.txt", filesystem)
968 fs.Create(t, "/tmp/b/findme.txt", filesystem)
982 fs.AssertSameResponse(t, foundPaths,
991 fs.Move(t, "/tmp/a", "/tmp/c", filesystem)
999 fs.AssertSameResponse(t, foundPaths,
1013 fs.AssertSameStatCalls(t, filesystem.StatCalls,
1015fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/c", "/tmp/c/1", "/tmp…
1022 fs.Create(t, "/tmp/findme.txt", filesystem)
1023 fs.Create(t, "/tmp/a/findme.txt", filesystem)
1024 fs.Create(t, "/tmp/a/1/findme.txt", filesystem)
1025 fs.Create(t, "/tmp/a/1/2/findme.txt", filesystem)
1026 fs.Create(t, "/tmp/b/findme.txt", filesystem)
1040 fs.AssertSameResponse(t, foundPaths,
1049 fs.Move(t, "/tmp/a", "/tmp/temp", filesystem)
1050 fs.Move(t, "/tmp/b", "/tmp/a", filesystem)
1051 fs.Move(t, "/tmp/temp", "/tmp/b", filesystem)
1059 fs.AssertSameResponse(t, foundPaths,
1073 fs.AssertSameStatCalls(t, filesystem.StatCalls,
1075fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp", "/tmp/a", "/tmp/b", "/tmp/b…
1082 func runFsReplacementTest(t *testing.T, fs1 *fs.MockFs, fs2 *fs.MockFs) {
1084 fs.Create(t, "/tmp/findme.txt", fs1)
1085 fs.Create(t, "/tmp/a/findme.txt", fs1)
1086 fs.Create(t, "/tmp/a/a/findme.txt", fs1)
1089 fs.Create(t, "/tmp/findme.txt", fs2)
1090 fs.Create(t, "/tmp/a/findme.txt", fs2)
1091 fs.Create(t, "/tmp/a/a/ignoreme.txt", fs2)
1092 fs.Create(t, "/tmp/a/b/findme.txt", fs2)
1106 fs.AssertSameResponse(t, foundPaths,
1110 cacheContent := fs.Read(t, finder.DbPath, fs1)
1111 fs.Write(t, finder.DbPath, cacheContent, fs2)
1125 fs.AssertSameResponse(t, foundPaths,
1127 fs.AssertSameStatCalls(t, fs2.StatCalls,
1129 fs.AssertSameReadDirCalls(t, fs2.ReadDirCalls,
1159 fs.Create(t, fmt.Sprintf("/tmp/%v/findme.txt", i), filesystem)
1175 string1 := fs.Read(t, finder.DbPath, filesystem)
1187 string2 := fs.Read(t, finder.DbPath, filesystem)
1210 fs.Create(t, "/tmp/findme.txt", filesystem)
1211 fs.Create(t, "/tmp/a/findme.txt", filesystem)
1212 fs.Create(t, "/tmp/a/misc.txt", filesystem)
1224 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/findme.txt", "/tmp/a/findme.txt"})
1230 fs.AssertSameResponse(t, refoundPaths, foundPaths)
1231 fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{})
1232 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
1240 fs.Create(t, "/tmp/findme.txt", filesystem)
1241 fs.Create(t, "/tmp/a/findme.txt", filesystem)
1242 fs.Create(t, "/tmp/a/metoo.txt", filesystem)
1254 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/findme.txt", "/tmp/a/findme.txt"})
1260 fs.AssertSameResponse(t, refoundPaths, []string{"/tmp/a/metoo.txt"})
1261 fs.AssertSameStatCalls(t, filesystem.StatCalls, []string{})
1262 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
1270 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1271 fs.Create(t, "/tmp/a/ignoreme.txt", filesystem)
1272 fs.Link(t, "/tmp/hi.txt", "a/hi.txt", filesystem)
1273 fs.Link(t, "/tmp/b/hi.txt", "../a/hi.txt", filesystem)
1274 fs.Link(t, "/tmp/c/hi.txt", "/tmp/hi.txt", filesystem)
1275 fs.Link(t, "/tmp/d/hi.txt", "../a/bye.txt", filesystem)
1276 fs.Link(t, "/tmp/d/bye.txt", "../a/hi.txt", filesystem)
1277 fs.Link(t, "/tmp/e/bye.txt", "../a/bye.txt", filesystem)
1278 fs.Link(t, "/tmp/f/hi.txt", "somethingThatDoesntExist", filesystem)
1299 fs.AssertSameResponse(t, foundPaths, correctResponse)
1306 fs.Create(t, "/tmp/dir/hi.txt", filesystem)
1307 fs.Create(t, "/tmp/dir/ignoreme.txt", filesystem)
1309 fs.Link(t, "/tmp/links/dir", "../dir", filesystem)
1310 fs.Link(t, "/tmp/links/link", "../dir", filesystem)
1311 fs.Link(t, "/tmp/links/hi.txt", "../dir", filesystem)
1312 fs.Link(t, "/tmp/links/broken", "nothingHere", filesystem)
1313 fs.Link(t, "/tmp/links/recursive", "recursive", filesystem)
1331 fs.AssertSameResponse(t, foundPaths, correctResponse)
1340 fs.Create(t, "/tmp/out/hi.txt", filesystem)
1341 fs.Create(t, "/tmp/out/a/hi.txt", filesystem)
1342 fs.Create(t, "/tmp/hi.txt", filesystem)
1358 fs.AssertSameResponse(t, foundPaths,
1367 fs.Create(t, "/tmp/out/.ignore-out-dir", filesystem)
1371 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/hi.txt"})
1378 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1379 fs.Create(t, "/tmp/b/bye.txt", filesystem)
1394 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/hi.txt"})
1398 fs.Create(t, "/tmp/b/hi.txt", filesystem)
1407 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/hi.txt", "/tmp/b/hi.txt"})
1408 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{"/tmp/b"})
1410 actualDbWriteTime := fs.ModTime(t, finder2.DbPath, filesystem)
1424 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/hi.txt", "/tmp/b/hi.txt"})
1425 fs.AssertSameReadDirCalls(t, filesystem.ReadDirCalls, []string{})
1427 actualDbWriteTime = fs.ModTime(t, finder3.DbPath, filesystem)
1437 fs.Create(t, "/tmp/hi.txt", filesystem)
1438 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1439 fs.Create(t, "/tmp/a/a/hi.txt", filesystem)
1440 fs.Create(t, "/tmp/b/hi.txt", filesystem)
1456 fs.AssertSameResponse(t, foundPaths, allPaths)
1461 fs.SetReadable(t, "/tmp/a", false, filesystem)
1469 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/hi.txt", "/tmp/b/hi.txt"})
1472 fs.SetReadable(t, "/tmp/a", true, filesystem)
1479 fs.AssertSameResponse(t, foundPaths, allPaths)
1485 fs.Create(t, "/tmp/hi.txt", filesystem)
1486 fs.SetReadable(t, "/tmp/hi.txt", false, filesystem)
1501 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/hi.txt"})
1507 fs.Create(t, "/tmp/a/hi.txt", filesystem)
1522 fs.AssertSameResponse(t, foundPaths, []string{"/tmp/a/hi.txt"})
1525 fs.SetReadErr(t, "/tmp/a", os.ErrInvalid, filesystem)