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

Side by Side Diff: tests/standalone/io/directory_fuzz_test.dart

Issue 11570005: Remove old #import, #source, and #library syntax from tests/standalone. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | Annotate | Revision Log
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 // 'fuzz' test the directory APIs by providing unexpected type 5 // 'fuzz' test the directory APIs by providing unexpected type
6 // arguments. The test passes if the VM does not crash. 6 // arguments. The test passes if the VM does not crash.
7 7
8 #import('dart:io'); 8 import "dart:io";
9 #import('dart:isolate'); 9 import "dart:isolate";
10 10
11 #import('fuzz_support.dart'); 11 import "fuzz_support.dart";
12 12
13 fuzzSyncMethods() { 13 fuzzSyncMethods() {
14 typeMapping.forEach((k, v) { 14 typeMapping.forEach((k, v) {
15 doItSync(() { 15 doItSync(() {
16 var d = new Directory(v); 16 var d = new Directory(v);
17 doItSync(d.existsSync); 17 doItSync(d.existsSync);
18 doItSync(d.createSync); 18 doItSync(d.createSync);
19 doItSync(d.deleteSync); 19 doItSync(d.deleteSync);
20 doItSync(() { 20 doItSync(() {
21 d.createTempSync().deleteSync(); 21 d.createTempSync().deleteSync();
22 }); 22 });
23 doItSync(() { 23 doItSync(() {
24 // Let's be a little careful. If the directory exists we don't 24 // Let's be a little careful. If the directory exists we don't
25 // want to delete it and all its contents. 25 // want to delete it and all its contents.
26 if (!d.existsSync()) d.deleteSync(recursive: true); 26 if (!d.existsSync()) d.deleteSync(recursive: true);
27 }); 27 });
28 typeMapping.forEach((k2, v2) { 28 typeMapping.forEach((k2, v2) {
29 doItSync(() => d.renameSync(v2)); 29 doItSync(() => d.renameSync(v2));
30 doItSync(() => d.list(v2).onError = (e) => null); 30 doItSync(() => d.list(recursive: v2).onError = (e) => null);
31 }); 31 });
32 }); 32 });
33 }); 33 });
34 } 34 }
35 35
36 fuzzAsyncMethods() { 36 fuzzAsyncMethods() {
37 var port = new ReceivePort(); 37 var port = new ReceivePort();
38 var futures = []; 38 var futures = [];
39 typeMapping.forEach((k, v) { 39 typeMapping.forEach((k, v) {
40 var d = new Directory(v); 40 var d = new Directory(v);
(...skipping 15 matching lines...) Expand all
56 futures.add(doItAsync(() => d.rename(v2))); 56 futures.add(doItAsync(() => d.rename(v2)));
57 }); 57 });
58 }); 58 });
59 Futures.wait(futures).then((ignore) => port.close()); 59 Futures.wait(futures).then((ignore) => port.close());
60 } 60 }
61 61
62 main() { 62 main() {
63 fuzzSyncMethods(); 63 fuzzSyncMethods();
64 fuzzAsyncMethods(); 64 fuzzAsyncMethods();
65 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698