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 sharedTests() { | 9 sharedTests() { |
10 test('does not notify for files that already exist when started', () { | 10 test('does not notify for files that already exist when started', () { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 test('notifies when a file is modified multiple times', () { | 45 test('notifies when a file is modified multiple times', () { |
46 writeFile("file.txt"); | 46 writeFile("file.txt"); |
47 startWatcher(); | 47 startWatcher(); |
48 writeFile("file.txt", contents: "modified"); | 48 writeFile("file.txt", contents: "modified"); |
49 expectModifyEvent("file.txt"); | 49 expectModifyEvent("file.txt"); |
50 writeFile("file.txt", contents: "modified again"); | 50 writeFile("file.txt", contents: "modified again"); |
51 expectModifyEvent("file.txt"); | 51 expectModifyEvent("file.txt"); |
52 }); | 52 }); |
53 | 53 |
| 54 test('notifies even if the file contents are unchanged', () { |
| 55 writeFile("a.txt", contents: "same"); |
| 56 writeFile("b.txt", contents: "before"); |
| 57 startWatcher(); |
| 58 writeFile("a.txt", contents: "same"); |
| 59 writeFile("b.txt", contents: "after"); |
| 60 expectModifyEvent("a.txt"); |
| 61 expectModifyEvent("b.txt"); |
| 62 }); |
| 63 |
54 test('when the watched directory is deleted, removes all files', () { | 64 test('when the watched directory is deleted, removes all files', () { |
55 writeFile("dir/a.txt"); | 65 writeFile("dir/a.txt"); |
56 writeFile("dir/b.txt"); | 66 writeFile("dir/b.txt"); |
57 | 67 |
58 startWatcher(dir: "dir"); | 68 startWatcher(dir: "dir"); |
59 | 69 |
60 deleteDir("dir"); | 70 deleteDir("dir"); |
61 inAnyOrder(() { | 71 inAnyOrder(() { |
62 expectRemoveEvent("dir/a.txt"); | 72 expectRemoveEvent("dir/a.txt"); |
63 expectRemoveEvent("dir/b.txt"); | 73 expectRemoveEvent("dir/b.txt"); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 deleteFile("dir/sub"); | 239 deleteFile("dir/sub"); |
230 renameDir("old", "dir/sub"); | 240 renameDir("old", "dir/sub"); |
231 inAnyOrder(() { | 241 inAnyOrder(() { |
232 expectRemoveEvent("dir/sub"); | 242 expectRemoveEvent("dir/sub"); |
233 withPermutations((i, j, k) => | 243 withPermutations((i, j, k) => |
234 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); | 244 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); |
235 }); | 245 }); |
236 }); | 246 }); |
237 }); | 247 }); |
238 } | 248 } |
OLD | NEW |