| 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 // 'fuzz' test the file APIs by providing unexpected type arguments. The test | 5 // 'fuzz' test the file APIs by providing unexpected type arguments. The test |
| 6 // passes if the VM does not crash. | 6 // passes if the VM does not crash. |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
| 11 | 11 |
| 12 import 'fuzz_support.dart'; | 12 import 'fuzz_support.dart'; |
| 13 | 13 |
| 14 fuzzSyncMethods() { | 14 fuzzSyncMethods() { |
| 15 typeMapping.forEach((k, v) { | 15 typeMapping.forEach((k, v) { |
| 16 doItSync(() { | 16 doItSync(() { |
| 17 var f = new File(v); | 17 var f = new File(v); |
| 18 doItSync(f.existsSync); | 18 doItSync(f.existsSync); |
| 19 doItSync(f.createSync); | 19 doItSync(f.createSync); |
| 20 doItSync(f.deleteSync); | 20 doItSync(f.deleteSync); |
| 21 doItSync(f.directorySync); | |
| 22 doItSync(f.lengthSync); | 21 doItSync(f.lengthSync); |
| 23 doItSync(f.modifiedSync); | 22 doItSync(f.modifiedSync); |
| 24 doItSync(f.fullPathSync); | 23 doItSync(f.fullPathSync); |
| 25 doItSync(() => f.openRead().listen(() {}, onError: (e) {})); | 24 doItSync(() => f.openRead().listen(() {}, onError: (e) {})); |
| 26 doItSync(f.readAsBytesSync); | 25 doItSync(f.readAsBytesSync); |
| 27 doItSync(f.readAsStringSync); | 26 doItSync(f.readAsStringSync); |
| 28 doItSync(f.readAsLinesSync); | 27 doItSync(f.readAsLinesSync); |
| 29 typeMapping.forEach((k2, v2) { | 28 typeMapping.forEach((k2, v2) { |
| 30 doItSync(() => f.openSync(mode: v2)); | 29 doItSync(() => f.openSync(mode: v2)); |
| 31 doItSync(() => f.openWrite(mode: v2)); | 30 doItSync(() => f.openWrite(mode: v2)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 temp.deleteSync(recursive: true); | 118 temp.deleteSync(recursive: true); |
| 120 }); | 119 }); |
| 121 } | 120 } |
| 122 | 121 |
| 123 main() { | 122 main() { |
| 124 fuzzSyncMethods(); | 123 fuzzSyncMethods(); |
| 125 fuzzAsyncMethods(); | 124 fuzzAsyncMethods(); |
| 126 fuzzSyncRandomAccessMethods(); | 125 fuzzSyncRandomAccessMethods(); |
| 127 fuzzAsyncRandomAccessMethods(); | 126 fuzzAsyncRandomAccessMethods(); |
| 128 } | 127 } |
| OLD | NEW |