| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/directory_watcher/mac_os.dart'; | 6 import 'package:watcher/src/directory_watcher/mac_os.dart'; |
| 7 import 'package:watcher/watcher.dart'; | 7 import 'package:watcher/watcher.dart'; |
| 8 | 8 |
| 9 import 'shared.dart'; | 9 import 'shared.dart'; |
| 10 import '../utils.dart'; | 10 import '../utils.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 createDir("dir"); | 29 createDir("dir"); |
| 30 writeFile("dir/old.txt"); | 30 writeFile("dir/old.txt"); |
| 31 deleteDir("dir"); | 31 deleteDir("dir"); |
| 32 createDir("dir"); | 32 createDir("dir"); |
| 33 | 33 |
| 34 startWatcher(dir: "dir"); | 34 startWatcher(dir: "dir"); |
| 35 writeFile("dir/newer.txt"); | 35 writeFile("dir/newer.txt"); |
| 36 expectAddEvent("dir/newer.txt"); | 36 expectAddEvent("dir/newer.txt"); |
| 37 }); | 37 }); |
| 38 | 38 |
| 39 test('notifies even if the file contents are unchanged', () { | |
| 40 writeFile("a.txt", contents: "same"); | |
| 41 writeFile("b.txt", contents: "before"); | |
| 42 startWatcher(); | |
| 43 writeFile("a.txt", contents: "same"); | |
| 44 writeFile("b.txt", contents: "after"); | |
| 45 expectModifyEvent("a.txt"); | |
| 46 expectModifyEvent("b.txt"); | |
| 47 }); | |
| 48 | |
| 49 test('emits events for many nested files moved out then immediately back in', | 39 test('emits events for many nested files moved out then immediately back in', |
| 50 () { | 40 () { |
| 51 withPermutations((i, j, k) => | 41 withPermutations((i, j, k) => |
| 52 writeFile("dir/sub/sub-$i/sub-$j/file-$k.txt")); | 42 writeFile("dir/sub/sub-$i/sub-$j/file-$k.txt")); |
| 53 | 43 |
| 54 startWatcher(dir: "dir"); | 44 startWatcher(dir: "dir"); |
| 55 | 45 |
| 56 renameDir("dir/sub", "sub"); | 46 renameDir("dir/sub", "sub"); |
| 57 renameDir("sub", "dir/sub"); | 47 renameDir("sub", "dir/sub"); |
| 58 | 48 |
| 59 inAnyOrder(() { | 49 inAnyOrder(() { |
| 60 withPermutations((i, j, k) => | 50 withPermutations((i, j, k) => |
| 61 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); | 51 expectRemoveEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); |
| 62 }); | 52 }); |
| 63 | 53 |
| 64 inAnyOrder(() { | 54 inAnyOrder(() { |
| 65 withPermutations((i, j, k) => | 55 withPermutations((i, j, k) => |
| 66 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); | 56 expectAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); |
| 67 }); | 57 }); |
| 68 }); | 58 }); |
| 69 } | 59 } |
| OLD | NEW |