OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library dart2js.analyze_test.test; | 5 library dart2js.analyze_test.test; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; |
10 import 'package:compiler/src/apiimpl.dart' show | 10 import 'package:compiler/src/apiimpl.dart' show |
(...skipping 26 matching lines...) Expand all Loading... |
37 "/data/", | 37 "/data/", |
38 "quarantined/http_launch_data/", | 38 "quarantined/http_launch_data/", |
39 "mirrors_helper.dart", | 39 "mirrors_helper.dart", |
40 "path%20with%20spaces/", | 40 "path%20with%20spaces/", |
41 // Broken tests: | 41 // Broken tests: |
42 "quarantined/http_test.dart", | 42 "quarantined/http_test.dart", |
43 // Package directory | 43 // Package directory |
44 "packages/", | 44 "packages/", |
45 ]; | 45 ]; |
46 | 46 |
| 47 List<Uri> computeInputUris({String filter}) { |
| 48 List<Uri> uriList = <Uri>[]; |
| 49 Directory dir = |
| 50 new Directory.fromUri(Uri.base.resolve('tests/compiler/dart2js/')); |
| 51 for (FileSystemEntity entity in dir.listSync(recursive: true)) { |
| 52 if (entity is File && entity.path.endsWith('.dart')) { |
| 53 Uri file = Uri.base.resolve(nativeToUriPath(entity.path)); |
| 54 if (filter != null && !'$file'.contains(filter)) { |
| 55 continue; |
| 56 } |
| 57 if (!SKIP_LIST.any((skip) => file.path.contains(skip))) { |
| 58 uriList.add(file); |
| 59 } |
| 60 } |
| 61 } |
| 62 return uriList; |
| 63 } |
| 64 |
47 main(List<String> arguments) { | 65 main(List<String> arguments) { |
48 List<String> options = <String>[]; | 66 List<String> options = <String>[]; |
49 List<Uri> uriList = <Uri>[]; | 67 List<Uri> uriList = <Uri>[]; |
50 String filter; | 68 String filter; |
51 bool first = true; | 69 bool first = true; |
52 for (String argument in arguments) { | 70 for (String argument in arguments) { |
53 if (argument.startsWith('-')) { | 71 if (argument.startsWith('-')) { |
54 options.add(argument == '-v' ? Flags.verbose : argument); | 72 options.add(argument == '-v' ? Flags.verbose : argument); |
55 } else if (first) { | 73 } else if (first) { |
56 File file = new File(argument); | 74 File file = new File(argument); |
(...skipping 14 matching lines...) Expand all Loading... |
71 filter = argument; | 89 filter = argument; |
72 } | 90 } |
73 } else { | 91 } else { |
74 throw new ArgumentError("Extra argument $argument in $arguments."); | 92 throw new ArgumentError("Extra argument $argument in $arguments."); |
75 } | 93 } |
76 first = false; | 94 first = false; |
77 } | 95 } |
78 | 96 |
79 asyncTest(() async { | 97 asyncTest(() async { |
80 if (uriList.isEmpty) { | 98 if (uriList.isEmpty) { |
81 Directory dir = | 99 uriList = computeInputUris(filter: filter); |
82 new Directory.fromUri(Uri.base.resolve('tests/compiler/dart2js/')); | |
83 for (FileSystemEntity entity in dir.listSync(recursive: true)) { | |
84 if (entity is File && entity.path.endsWith('.dart')) { | |
85 Uri file = Uri.base.resolve(nativeToUriPath(entity.path)); | |
86 if (filter != null && !'$file'.contains(filter)) { | |
87 continue; | |
88 } | |
89 if (!SKIP_LIST.any((skip) => file.path.contains(skip))) { | |
90 uriList.add(file); | |
91 } | |
92 } | |
93 } | |
94 } | 100 } |
95 await analyze( | 101 await analyze( |
96 uriList, | 102 uriList, |
97 WHITE_LIST, | 103 WHITE_LIST, |
98 mode: AnalysisMode.URI, | 104 mode: AnalysisMode.URI, |
99 options: options); | 105 options: options); |
100 }); | 106 }); |
101 } | 107 } |
OLD | NEW |