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

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

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
« no previous file with comments | « packages/watcher/pubspec.yaml ('k') | packages/watcher/test/file_watcher/native_test.dart » ('j') | 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 startWatcher(path: "dir"); 85 startWatcher(path: "dir");
86 86
87 renameDir("dir", "moved_dir"); 87 renameDir("dir", "moved_dir");
88 createDir("dir"); 88 createDir("dir");
89 inAnyOrder([ 89 inAnyOrder([
90 isRemoveEvent("dir/a.txt"), 90 isRemoveEvent("dir/a.txt"),
91 isRemoveEvent("dir/b.txt") 91 isRemoveEvent("dir/b.txt")
92 ]); 92 ]);
93 }); 93 });
94 94
95 // Regression test for b/30768513.
96 test("doesn't crash when the directory is moved immediately after a subdir "
97 "is added", () {
98 writeFile("dir/a.txt");
99 writeFile("dir/b.txt");
100
101 startWatcher(path: "dir");
102
103 createDir("dir/subdir");
104 renameDir("dir", "moved_dir");
105 createDir("dir");
106 inAnyOrder([
107 isRemoveEvent("dir/a.txt"),
108 isRemoveEvent("dir/b.txt")
109 ]);
110 });
111
95 group("moves", () { 112 group("moves", () {
96 test('notifies when a file is moved within the watched directory', () { 113 test('notifies when a file is moved within the watched directory', () {
97 writeFile("old.txt"); 114 writeFile("old.txt");
98 startWatcher(); 115 startWatcher();
99 renameFile("old.txt", "new.txt"); 116 renameFile("old.txt", "new.txt");
100 117
101 inAnyOrder([ 118 inAnyOrder([
102 isAddEvent("new.txt"), 119 isAddEvent("new.txt"),
103 isRemoveEvent("old.txt") 120 isRemoveEvent("old.txt")
104 ]); 121 ]);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 renameDir("old", "new"); 256 renameDir("old", "new");
240 inAnyOrder([ 257 inAnyOrder([
241 isRemoveEvent("old/file.txt"), 258 isRemoveEvent("old/file.txt"),
242 isAddEvent("new/file.txt") 259 isAddEvent("new/file.txt")
243 ]); 260 ]);
244 261
245 writeFile("new/file.txt", contents: "modified"); 262 writeFile("new/file.txt", contents: "modified");
246 expectModifyEvent("new/file.txt"); 263 expectModifyEvent("new/file.txt");
247 }); 264 });
248 265
266 test('notifies when a file is replaced by a subdirectory', () {
267 writeFile("new");
268 writeFile("old/file.txt");
269 startWatcher();
270
271 deleteFile("new");
272 renameDir("old", "new");
273 inAnyOrder([
274 isRemoveEvent("new"),
275 isRemoveEvent("old/file.txt"),
276 isAddEvent("new/file.txt")
277 ]);
278 });
279
280 test('notifies when a subdirectory is replaced by a file', () {
281 writeFile("old");
282 writeFile("new/file.txt");
283 startWatcher();
284
285 renameDir("new", "newer");
286 renameFile("old", "new");
287 inAnyOrder([
288 isRemoveEvent("new/file.txt"),
289 isAddEvent("newer/file.txt"),
290 isRemoveEvent("old"),
291 isAddEvent("new")
292 ]);
293 }, onPlatform: {
294 "mac-os": new Skip("https://github.com/dart-lang/watcher/issues/21")
295 });
296
249 test('emits events for many nested files added at once', () { 297 test('emits events for many nested files added at once', () {
250 withPermutations((i, j, k) => 298 withPermutations((i, j, k) =>
251 writeFile("sub/sub-$i/sub-$j/file-$k.txt")); 299 writeFile("sub/sub-$i/sub-$j/file-$k.txt"));
252 300
253 createDir("dir"); 301 createDir("dir");
254 startWatcher(path: "dir"); 302 startWatcher(path: "dir");
255 renameDir("sub", "dir/sub"); 303 renameDir("sub", "dir/sub");
256 304
257 inAnyOrder(withPermutations((i, j, k) => 305 inAnyOrder(withPermutations((i, j, k) =>
258 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"))); 306 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 deleteFile("dir/sub"); 349 deleteFile("dir/sub");
302 renameDir("old", "dir/sub"); 350 renameDir("old", "dir/sub");
303 351
304 var events = withPermutations((i, j, k) => 352 var events = withPermutations((i, j, k) =>
305 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt")); 353 isAddEvent("dir/sub/sub-$i/sub-$j/file-$k.txt"));
306 events.add(isRemoveEvent("dir/sub")); 354 events.add(isRemoveEvent("dir/sub"));
307 inAnyOrder(events); 355 inAnyOrder(events);
308 }); 356 });
309 }); 357 });
310 } 358 }
OLDNEW
« no previous file with comments | « packages/watcher/pubspec.yaml ('k') | packages/watcher/test/file_watcher/native_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698