OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
6 | 6 |
7 import '../utils.dart'; | 7 import '../utils.dart'; |
8 | 8 |
| 9 import 'dart:async'; |
| 10 |
9 sharedTests() { | 11 sharedTests() { |
10 test('does not notify for files that already exist when started', () { | 12 test('does not notify for files that already exist when started', () { |
11 // Make some pre-existing files. | 13 // Make some pre-existing files. |
12 writeFile("a.txt"); | 14 writeFile("a.txt"); |
13 writeFile("b.txt"); | 15 writeFile("b.txt"); |
14 | 16 |
15 startWatcher(); | 17 startWatcher(); |
16 | 18 |
17 // Change one after the watcher is running. | 19 // Change one after the watcher is running. |
18 writeFile("b.txt", contents: "modified"); | 20 writeFile("b.txt", contents: "modified"); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 startWatcher(dir: "dir"); | 213 startWatcher(dir: "dir"); |
212 renameDir("dir/old", "dir/new"); | 214 renameDir("dir/old", "dir/new"); |
213 | 215 |
214 inAnyOrder(() { | 216 inAnyOrder(() { |
215 withPermutations((i, j, k) { | 217 withPermutations((i, j, k) { |
216 expectRemoveEvent("dir/old/sub-$i/sub-$j/file-$k.txt"); | 218 expectRemoveEvent("dir/old/sub-$i/sub-$j/file-$k.txt"); |
217 expectAddEvent("dir/new/sub-$i/sub-$j/file-$k.txt"); | 219 expectAddEvent("dir/new/sub-$i/sub-$j/file-$k.txt"); |
218 }); | 220 }); |
219 }); | 221 }); |
220 }); | 222 }); |
| 223 |
| 224 test("emits events for many files added at once in a subdirectory with the " |
| 225 "same name as a removed file", () { |
| 226 writeFile("dir/sub"); |
| 227 withPermutations((i, j, k) => |
| 228 writeFile("old/sub-$i/sub-$j/file-$k.txt")); |
| 229 startWatcher(dir: "dir"); |
| 230 |
| 231 deleteFile("dir/sub"); |
| 232 renameDir("old", "dir/sub"); |
| 233 inAnyOrder(() { |
| 234 expectRemoveEvent("dir/sub"); |
| 235 withPermutations((i, j, k) => |
| 236 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); |
| 237 }); |
| 238 }); |
221 }); | 239 }); |
222 } | 240 } |
OLD | NEW |