Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: test/directory_watcher/shared.dart

Issue 861313006: Treat add events for known files as modifications instead of discarding them on Mac OS. Fixes pub s… (Closed) Base URL: https://github.com/dart-lang/watcher.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« lib/src/directory_watcher/mac_os.dart ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 void sharedTests() { 10 void sharedTests() {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 expectAddEvent("dir/new.txt"); 114 expectAddEvent("dir/new.txt");
115 }); 115 });
116 116
117 test('notifies when a file is moved outside the watched directory', () { 117 test('notifies when a file is moved outside the watched directory', () {
118 writeFile("dir/old.txt"); 118 writeFile("dir/old.txt");
119 startWatcher(dir: "dir"); 119 startWatcher(dir: "dir");
120 120
121 renameFile("dir/old.txt", "new.txt"); 121 renameFile("dir/old.txt", "new.txt");
122 expectRemoveEvent("dir/old.txt"); 122 expectRemoveEvent("dir/old.txt");
123 }); 123 });
124
125 test('notifies when a file is moved onto an existing one', () {
126 writeFile("from.txt");
127 writeFile("to.txt");
128 startWatcher();
129
130 renameFile("from.txt", "to.txt");
131 inAnyOrder([
132 isRemoveEvent("from.txt"),
133 isModifyEvent("to.txt")
134 ]);
135 });
124 }); 136 });
125 137
126 // Most of the time, when multiple filesystem actions happen in sequence, 138 // Most of the time, when multiple filesystem actions happen in sequence,
127 // they'll be batched together and the watcher will see them all at once. 139 // they'll be batched together and the watcher will see them all at once.
128 // These tests verify that the watcher normalizes and combine these events 140 // These tests verify that the watcher normalizes and combine these events
129 // properly. However, very occasionally the events will be reported in 141 // properly. However, very occasionally the events will be reported in
130 // separate batches, and the watcher will report them as though they occurred 142 // separate batches, and the watcher will report them as though they occurred
131 // far apart in time, so each of these tests has a "backup case" to allow for 143 // far apart in time, so each of these tests has a "backup case" to allow for
132 // that as well. 144 // that as well.
133 group("clustered changes", () { 145 group("clustered changes", () {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 deleteFile("dir/sub"); 301 deleteFile("dir/sub");
290 renameDir("old", "dir/sub"); 302 renameDir("old", "dir/sub");
291 303
292 var events = withPermutations((i, j, k) => 304 var events = withPermutations((i, j, k) =>
293 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); 305 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
294 events.add(isRemoveEvent("dir/sub")); 306 events.add(isRemoveEvent("dir/sub"));
295 inAnyOrder(events); 307 inAnyOrder(events);
296 }); 308 });
297 }); 309 });
298 } 310 }
OLDNEW
« lib/src/directory_watcher/mac_os.dart ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698