| 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 import 'package:watcher/src/utils.dart'; | 6 import 'package:watcher/src/utils.dart'; |
| 7 | 7 |
| 8 import '../utils.dart'; | 8 import '../utils.dart'; |
| 9 | 9 |
| 10 sharedTests() { | 10 sharedTests() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 startWatcher(dir: "dir"); | 72 startWatcher(dir: "dir"); |
| 73 | 73 |
| 74 deleteDir("dir"); | 74 deleteDir("dir"); |
| 75 inAnyOrder([ | 75 inAnyOrder([ |
| 76 isRemoveEvent("dir/a.txt"), | 76 isRemoveEvent("dir/a.txt"), |
| 77 isRemoveEvent("dir/b.txt") | 77 isRemoveEvent("dir/b.txt") |
| 78 ]); | 78 ]); |
| 79 }); | 79 }); |
| 80 | 80 |
| 81 test('when the watched directory is moved, removes all files', () { |
| 82 writeFile("dir/a.txt"); |
| 83 writeFile("dir/b.txt"); |
| 84 |
| 85 startWatcher(dir: "dir"); |
| 86 |
| 87 renameDir("dir", "moved_dir"); |
| 88 createDir("dir"); |
| 89 inAnyOrder([ |
| 90 isRemoveEvent("dir/a.txt"), |
| 91 isRemoveEvent("dir/b.txt") |
| 92 ]); |
| 93 }); |
| 94 |
| 81 group("moves", () { | 95 group("moves", () { |
| 82 test('notifies when a file is moved within the watched directory', () { | 96 test('notifies when a file is moved within the watched directory', () { |
| 83 writeFile("old.txt"); | 97 writeFile("old.txt"); |
| 84 startWatcher(); | 98 startWatcher(); |
| 85 renameFile("old.txt", "new.txt"); | 99 renameFile("old.txt", "new.txt"); |
| 86 | 100 |
| 87 inAnyOrder([ | 101 inAnyOrder([ |
| 88 isAddEvent("new.txt"), | 102 isAddEvent("new.txt"), |
| 89 isRemoveEvent("old.txt") | 103 isRemoveEvent("old.txt") |
| 90 ]); | 104 ]); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 deleteFile("dir/sub"); | 289 deleteFile("dir/sub"); |
| 276 renameDir("old", "dir/sub"); | 290 renameDir("old", "dir/sub"); |
| 277 | 291 |
| 278 var events = withPermutations((i, j, k) => | 292 var events = withPermutations((i, j, k) => |
| 279 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); | 293 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); |
| 280 events.add(isRemoveEvent("dir/sub")); | 294 events.add(isRemoveEvent("dir/sub")); |
| 281 inAnyOrder(events); | 295 inAnyOrder(events); |
| 282 }); | 296 }); |
| 283 }); | 297 }); |
| 284 } | 298 } |
| OLD | NEW |