| 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 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 fuzzAsyncMethods() { | 39 fuzzAsyncMethods() { |
| 40 asyncStart(); | 40 asyncStart(); |
| 41 var futures = []; | 41 var futures = []; |
| 42 typeMapping.forEach((k, v) { | 42 typeMapping.forEach((k, v) { |
| 43 doItSync(() { | 43 doItSync(() { |
| 44 var f = new File(v); | 44 var f = new File(v); |
| 45 futures.add(doItAsync(f.exists)); | 45 futures.add(doItAsync(f.exists)); |
| 46 futures.add(doItAsync(f.delete)); | 46 futures.add(doItAsync(f.delete)); |
| 47 futures.add(doItAsync(f.directory)); | 47 futures.add(doItAsync(f.parent)); |
| 48 futures.add(doItAsync(f.length)); | 48 futures.add(doItAsync(f.length)); |
| 49 futures.add(doItAsync(f.modified)); | 49 futures.add(doItAsync(f.modified)); |
| 50 futures.add(doItAsync(f.open)); | 50 futures.add(doItAsync(f.open)); |
| 51 futures.add(doItAsync(f.fullPath)); | 51 futures.add(doItAsync(f.fullPath)); |
| 52 futures.add(doItAsync(f.readAsBytes)); | 52 futures.add(doItAsync(f.readAsBytes)); |
| 53 futures.add(doItAsync(f.readAsLines)); | 53 futures.add(doItAsync(f.readAsLines)); |
| 54 futures.add(doItAsync(f.readAsString)); | 54 futures.add(doItAsync(f.readAsString)); |
| 55 typeMapping.forEach((k2, v2) { | 55 typeMapping.forEach((k2, v2) { |
| 56 futures.add(doItAsync(() => f.open(mode: v2))); | 56 futures.add(doItAsync(() => f.open(mode: v2))); |
| 57 futures.add(doItAsync(() => f.readAsString(encoding: v2))); | 57 futures.add(doItAsync(() => f.readAsString(encoding: v2))); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 temp.deleteSync(recursive: true); | 117 temp.deleteSync(recursive: true); |
| 118 }); | 118 }); |
| 119 } | 119 } |
| 120 | 120 |
| 121 main() { | 121 main() { |
| 122 fuzzSyncMethods(); | 122 fuzzSyncMethods(); |
| 123 fuzzAsyncMethods(); | 123 fuzzAsyncMethods(); |
| 124 fuzzSyncRandomAccessMethods(); | 124 fuzzSyncRandomAccessMethods(); |
| 125 fuzzAsyncRandomAccessMethods(); | 125 fuzzAsyncRandomAccessMethods(); |
| 126 } | 126 } |
| OLD | NEW |