Chromium Code Reviews| 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; |
| 11 | 11 |
| 12 import 'package:async_helper/async_helper.dart'; | 12 import 'package:async_helper/async_helper.dart'; |
| 13 import 'package:expect/expect.dart'; | 13 import 'package:expect/expect.dart'; |
| 14 | 14 |
| 15 import 'package:compiler/compiler.dart' as api; | 15 import 'package:compiler/compiler.dart' as api; |
| 16 import 'package:compiler/implementation/dart2js.dart' as entry; | 16 import 'package:compiler/implementation/dart2js.dart' as entry; |
| 17 import 'package:compiler/implementation/dart2jslib.dart'; | 17 import 'package:compiler/implementation/dart2jslib.dart'; |
| 18 import 'package:compiler/implementation/apiimpl.dart' as apiimpl; | 18 import 'package:compiler/implementation/apiimpl.dart' as apiimpl; |
| 19 import 'package:compiler/implementation/elements/elements.dart'; | 19 import 'package:compiler/implementation/elements/elements.dart'; |
| 20 import 'package:compiler/implementation/library_loader.dart'; | |
| 20 import 'package:compiler/implementation/resolution/resolution.dart'; | 21 import 'package:compiler/implementation/resolution/resolution.dart'; |
| 21 import 'package:compiler/implementation/scanner/scannerlib.dart'; | 22 import 'package:compiler/implementation/scanner/scannerlib.dart'; |
| 22 import 'package:compiler/implementation/util/util.dart'; | 23 import 'package:compiler/implementation/util/util.dart'; |
| 23 | 24 |
| 24 class TestCompiler extends apiimpl.Compiler { | 25 class TestCompiler extends apiimpl.Compiler { |
| 25 final String testMarker; | 26 final String testMarker; |
| 26 final String testType; | 27 final String testType; |
| 27 final Function onTest; | 28 final Function onTest; |
| 28 | 29 |
| 29 TestCompiler(api.CompilerInputProvider inputProvider, | 30 TestCompiler(api.CompilerInputProvider inputProvider, |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 41 scanner = new TestScanner(this); | 42 scanner = new TestScanner(this); |
| 42 resolver = new TestResolver(this, backend.constantCompilerTask); | 43 resolver = new TestResolver(this, backend.constantCompilerTask); |
| 43 test('Compiler'); | 44 test('Compiler'); |
| 44 } | 45 } |
| 45 | 46 |
| 46 Future<bool> run(Uri uri) { | 47 Future<bool> run(Uri uri) { |
| 47 test('Compiler.run'); | 48 test('Compiler.run'); |
| 48 return super.run(uri); | 49 return super.run(uri); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void onLibraryScanned(LibraryElement element) { | 52 Future onLibraryScanned(LibraryElement element, |
| 53 LibraryLoader loader) { | |
|
floitsch
2014/06/24 09:01:54
one line?
Johnni Winther
2014/06/24 09:12:59
Done.
| |
| 52 test('Compiler.onLibraryScanned'); | 54 test('Compiler.onLibraryScanned'); |
| 53 super.onLibraryScanned(element); | 55 return super.onLibraryScanned(element, loader); |
| 54 } | 56 } |
| 55 | 57 |
| 56 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { | 58 Future onLibrariesLoaded(Map<Uri, LibraryElement> loadedLibraries) { |
| 57 test('Compiler.onLibrariesLoaded'); | 59 test('Compiler.onLibrariesLoaded'); |
| 58 return super.onLibrariesLoaded(loadedLibraries); | 60 return super.onLibrariesLoaded(loadedLibraries); |
| 59 } | 61 } |
| 60 | 62 |
| 61 TreeElements analyzeElement(Element element) { | 63 TreeElements analyzeElement(Element element) { |
| 62 test('Compiler.analyzeElement'); | 64 test('Compiler.analyzeElement'); |
| 63 return super.analyzeElement(element); | 65 return super.analyzeElement(element); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 int countResults(Map runType) { | 266 int countResults(Map runType) { |
| 265 return runType.length * | 267 return runType.length * |
| 266 tests.values.where((r) => r == runType).length; | 268 tests.values.where((r) => r == runType).length; |
| 267 } | 269 } |
| 268 | 270 |
| 269 Expect.equals(countResults(beforeRun) + countResults(duringRun), | 271 Expect.equals(countResults(beforeRun) + countResults(duringRun), |
| 270 checkedResults); | 272 checkedResults); |
| 271 asyncEnd(); | 273 asyncEnd(); |
| 272 }); | 274 }); |
| 273 } | 275 } |
| OLD | NEW |