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 // Test the exit code of dart2js in case of exceptions, fatal errors, errors, | 5 // Test the exit code of dart2js in case of exceptions, fatal errors, errors, |
6 // warnings, etc. | 6 // warnings, etc. |
7 | 7 |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:io' show Platform; | 10 import 'dart:io' show Platform; |
(...skipping 30 matching lines...) Expand all Loading... |
41 scanner = new TestScanner(this); | 41 scanner = new TestScanner(this); |
42 resolver = new TestResolver(this, backend.constantCompilerTask); | 42 resolver = new TestResolver(this, backend.constantCompilerTask); |
43 test('Compiler'); | 43 test('Compiler'); |
44 } | 44 } |
45 | 45 |
46 Future<bool> run(Uri uri) { | 46 Future<bool> run(Uri uri) { |
47 test('Compiler.run'); | 47 test('Compiler.run'); |
48 return super.run(uri); | 48 return super.run(uri); |
49 } | 49 } |
50 | 50 |
51 Future scanBuiltinLibraries() { | 51 void onLibraryScanned(LibraryElement element) { |
52 test('Compiler.scanBuiltinLibraries'); | 52 test('Compiler.onLibraryScanned'); |
53 return super.scanBuiltinLibraries(); | 53 super.onLibraryScanned(element); |
54 } | 54 } |
55 | 55 |
56 void initializeSpecialClasses() { | 56 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
57 test('Compiler.initializeSpecialClasses'); | 57 test('Compiler.onLibrariesLoaded'); |
58 super.initializeSpecialClasses(); | 58 return super.onLibrariesLoaded(loadedLibraries); |
59 } | 59 } |
60 | 60 |
61 TreeElements analyzeElement(Element element) { | 61 TreeElements analyzeElement(Element element) { |
62 test('Compiler.analyzeElement'); | 62 test('Compiler.analyzeElement'); |
63 return super.analyzeElement(element); | 63 return super.analyzeElement(element); |
64 } | 64 } |
65 | 65 |
66 void codegen(CodegenWorkItem work, CodegenEnqueuer world) { | 66 void codegen(CodegenWorkItem work, CodegenEnqueuer world) { |
67 test('Compiler.codegen'); | 67 test('Compiler.codegen'); |
68 super.codegen(work, world); | 68 super.codegen(work, world); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 'invariant': 253, | 241 'invariant': 253, |
242 'warning': 0, | 242 'warning': 0, |
243 'error': 1, | 243 'error': 1, |
244 'fatalError': 1, | 244 'fatalError': 1, |
245 'internalError': 253, | 245 'internalError': 253, |
246 }; | 246 }; |
247 | 247 |
248 final tests = { | 248 final tests = { |
249 'Compiler': beforeRun, | 249 'Compiler': beforeRun, |
250 'Compiler.run': beforeRun, | 250 'Compiler.run': beforeRun, |
251 'Compiler.scanBuiltinLibraries': beforeRun, | 251 'Compiler.onLibraryScanned': beforeRun, |
252 'Compiler.initializeSpecialClasses': beforeRun, | 252 'Compiler.onLibrariesLoaded': beforeRun, |
253 'ScannerTask.scanElements': duringRun, | 253 'ScannerTask.scanElements': duringRun, |
254 'Compiler.withCurrentElement': duringRun, | 254 'Compiler.withCurrentElement': duringRun, |
255 'Compiler.analyzeElement': duringRun, | 255 'Compiler.analyzeElement': duringRun, |
256 'Compiler.codegen': duringRun, | 256 'Compiler.codegen': duringRun, |
257 'ResolverTask.computeClassMembers': duringRun, | 257 'ResolverTask.computeClassMembers': duringRun, |
258 }; | 258 }; |
259 | 259 |
260 asyncStart(); | 260 asyncStart(); |
261 Future.forEach(tests.keys, (marker) { | 261 Future.forEach(tests.keys, (marker) { |
262 return testExitCodes(marker, tests[marker]); | 262 return testExitCodes(marker, tests[marker]); |
263 }).then((_) { | 263 }).then((_) { |
264 int countResults(Map runType) { | 264 int countResults(Map runType) { |
265 return runType.length * | 265 return runType.length * |
266 tests.values.where((r) => r == runType).length; | 266 tests.values.where((r) => r == runType).length; |
267 } | 267 } |
268 | 268 |
269 Expect.equals(countResults(beforeRun) + countResults(duringRun), | 269 Expect.equals(countResults(beforeRun) + countResults(duringRun), |
270 checkedResults); | 270 checkedResults); |
271 asyncEnd(); | 271 asyncEnd(); |
272 }); | 272 }); |
273 } | 273 } |
OLD | NEW |