OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 'dart:async' show | 5 import 'dart:async' show |
6 Future, | 6 Future, |
7 Stream, | 7 Stream, |
8 StreamController; | 8 StreamController; |
9 | 9 |
10 import 'dart:io' show | 10 import 'dart:io' show |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 Future<Map<String, NoArgFuture>> listTests( | 46 Future<Map<String, NoArgFuture>> listTests( |
47 [bool writeGoldenFiles = false]) async { | 47 [bool writeGoldenFiles = false]) async { |
48 Map<String, NoArgFuture> tests = new Map<String, NoArgFuture>(); | 48 Map<String, NoArgFuture> tests = new Map<String, NoArgFuture>(); |
49 | 49 |
50 Directory directory = | 50 Directory directory = |
51 new Directory(testDirectory()); | 51 new Directory(testDirectory()); |
52 | 52 |
53 String suffix = "_test.dart"; | 53 String suffix = "_test.dart"; |
54 | 54 |
55 Iterable<File> testFiles = directory.listSync().where((FileSystemEntity e) { | 55 Iterable<FileSystemEntity> testFiles = directory.listSync().where((FileSystemE
ntity e) { |
56 return e is File && e.path.endsWith(suffix); | 56 return e is File && e.path.endsWith(suffix); |
57 }); | 57 }); |
58 | 58 |
59 testFiles.forEach((File file) { | 59 testFiles.forEach((File file) { |
60 String path = file.path; | 60 String path = file.path; |
61 String filename = path.split(Platform.pathSeparator).last; | 61 String filename = path.split(Platform.pathSeparator).last; |
62 String name = filename.substring(0, filename.length - suffix.length); | 62 String name = filename.substring(0, filename.length - suffix.length); |
63 tests["snapshot_stacktrace_tests/$name"] = | 63 tests["snapshot_stacktrace_tests/$name"] = |
64 () => runTest(name, writeGoldenFiles); | 64 () => runTest(name, writeGoldenFiles); |
65 }); | 65 }); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 String testDirectory([String generated = '']) | 127 String testDirectory([String generated = '']) |
128 => 'tests/snapshot_stacktrace_tests$generated'; | 128 => 'tests/snapshot_stacktrace_tests$generated'; |
129 | 129 |
130 main() async { | 130 main() async { |
131 var tests = await listTests(true); | 131 var tests = await listTests(true); |
132 for (var name in tests.keys) { | 132 for (var name in tests.keys) { |
133 await tests[name](); | 133 await tests[name](); |
134 } | 134 } |
135 } | 135 } |
OLD | NEW |