(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func TestEventOrdering(t *testing.T) { |
| 66 | if runtime.GOOS == "windows" { |
| 67 | // https://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw_19.html |
| 68 | t.Skip("Windows doesn't make great guarantees about duplicate/out-of-order events") |
| 69 | return |
| 70 | } |
| 71 | f := newNotifyFixture(t) |
| 72 | |
| 73 | count := 8 |
| 74 | dirs := make([]string, count) |
| 75 | for i := range dirs { |
| 76 | dir := f.TempDir("watched") |
| 77 | dirs[i] = dir |
| 78 | f.watch(dir) |
| 79 | } |
| 80 | |
| 81 | f.fsync() |
| 82 | f.events = nil |
| 83 | |
| 84 | var expected []string |
| 85 | for i, dir := range dirs { |
| 86 | base := fmt.Sprintf("%d.txt", i) |
| 87 | p := filepath.Join(dir, base) |
| 88 | err := os.WriteFile(p, []byte(base), os.FileMode(0o777)) |
| 89 | if err != nil { |
| 90 | t.Fatal(err) |
| 91 | } |
| 92 | expected = append(expected, filepath.Join(dir, base)) |
| 93 | } |
| 94 | |
| 95 | f.assertEvents(expected...) |
| 96 | } |
| 97 | |
| 98 | // Simulate a git branch switch that creates a bunch |
| 99 | // of directories, creates files in them, then deletes |
nothing calls this directly
no test coverage detected