Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: tests/compiler/dart2js/exit_code_test.dart

Issue 2760923004: Eliminate multi-callback structure for LibraryLoader. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, errors, warnings, etc. 5 // Test the exit code of dart2js in case of exceptions, errors, warnings, etc.
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' show Platform; 8 import 'dart:io' show Platform;
9 9
10 import 'package:async_helper/async_helper.dart'; 10 import 'package:async_helper/async_helper.dart';
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 @override 67 @override
68 ResolverTask createResolverTask() { 68 ResolverTask createResolverTask() {
69 return new TestResolver(this, backend.constantCompilerTask); 69 return new TestResolver(this, backend.constantCompilerTask);
70 } 70 }
71 71
72 Future<bool> run(Uri uri) { 72 Future<bool> run(Uri uri) {
73 test('Compiler.run'); 73 test('Compiler.run');
74 return super.run(uri); 74 return super.run(uri);
75 } 75 }
76 76
77 Future onLibraryScanned(LibraryElement element, LibraryLoader loader) { 77 LoadedLibraries processLoadedLibraries(LoadedLibraries loadedLibraries) {
78 test('Compiler.onLibraryScanned'); 78 test('Compiler.processLoadedLibraries');
79 return super.onLibraryScanned(element, loader); 79 return super.processLoadedLibraries(loadedLibraries);
80 }
81
82 Future onLibrariesLoaded(LoadedLibraries loadedLibraries) {
83 test('Compiler.onLibrariesLoaded');
84 return super.onLibrariesLoaded(loadedLibraries);
85 } 80 }
86 81
87 test(String marker) { 82 test(String marker) {
88 if (marker == testMarker) { 83 if (marker == testMarker) {
89 switch (testType) { 84 switch (testType) {
90 case 'assert': 85 case 'assert':
91 onTest(testMarker, testType); 86 onTest(testMarker, testType);
92 assert(false); 87 assert(false);
93 break; 88 break;
94 case 'invariant': 89 case 'invariant':
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 'error': 1, 284 'error': 1,
290 'internalError': 253, 285 'internalError': 253,
291 }; 286 };
292 } 287 }
293 288
294 const beforeRun = false; 289 const beforeRun = false;
295 const duringRun = true; 290 const duringRun = true;
296 final tests = { 291 final tests = {
297 'Compiler': beforeRun, 292 'Compiler': beforeRun,
298 'Compiler.run': beforeRun, 293 'Compiler.run': beforeRun,
299 'Compiler.onLibraryScanned': beforeRun, 294 'Compiler.processLoadedLibraries': beforeRun,
300 'Compiler.onLibrariesLoaded': beforeRun,
301 'ScannerTask.scanElements': duringRun, 295 'ScannerTask.scanElements': duringRun,
302 'Compiler.withCurrentElement': duringRun, 296 'Compiler.withCurrentElement': duringRun,
303 'Compiler.analyzeElement': duringRun, 297 'Compiler.analyzeElement': duringRun,
304 'Compiler.codegen': duringRun, 298 'Compiler.codegen': duringRun,
305 'ResolverTask.computeClassMembers': duringRun, 299 'ResolverTask.computeClassMembers': duringRun,
306 }; 300 };
307 int totalExpectedErrors = 0; 301 int totalExpectedErrors = 0;
308 302
309 asyncTest(() async { 303 asyncTest(() async {
310 for (String marker in tests.keys) { 304 for (String marker in tests.keys) {
311 var expected = _expectedExitCode(beforeRun: tests[marker]); 305 var expected = _expectedExitCode(beforeRun: tests[marker]);
312 totalExpectedErrors += expected.length; 306 totalExpectedErrors += expected.length;
313 await testExitCodes(marker, expected, []); 307 await testExitCodes(marker, expected, []);
314 308
315 expected = 309 expected =
316 _expectedExitCode(beforeRun: tests[marker], fatalWarnings: true); 310 _expectedExitCode(beforeRun: tests[marker], fatalWarnings: true);
317 totalExpectedErrors += expected.length; 311 totalExpectedErrors += expected.length;
318 await testExitCodes(marker, expected, ['--fatal-warnings']); 312 await testExitCodes(marker, expected, ['--fatal-warnings']);
319 } 313 }
320 314
321 Expect.equals(totalExpectedErrors, checkedResults); 315 Expect.equals(totalExpectedErrors, checkedResults);
322 }); 316 });
323 } 317 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698