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

Side by Side Diff: tests/compiler/dart2js/part_of_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 library part_of_test; 5 library part_of_test;
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind; 9 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
10 import 'mock_compiler.dart'; 10 import 'mock_compiler.dart';
11 11
12 final libraryUri = Uri.parse('test:library.dart'); 12 final libraryUri = Uri.parse('test:library.dart');
13 const String LIBRARY_SOURCE = ''' 13 const String LIBRARY_SOURCE = '''
14 library foo; 14 library foo;
15 part 'part.dart'; 15 part 'part.dart';
16 '''; 16 ''';
17 17
18 final partUri = Uri.parse('test:part.dart'); 18 final partUri = Uri.parse('test:part.dart');
19 const String PART_SOURCE = ''' 19 const String PART_SOURCE = '''
20 part of bar; 20 part of bar;
21 '''; 21 ''';
22 22
23 void main() { 23 void main() {
24 MockCompiler compiler = new MockCompiler.internal(); 24 MockCompiler compiler = new MockCompiler.internal();
25 compiler.registerSource(libraryUri, LIBRARY_SOURCE); 25 compiler.registerSource(libraryUri, LIBRARY_SOURCE);
26 compiler.registerSource(partUri, PART_SOURCE); 26 compiler.registerSource(partUri, PART_SOURCE);
27 27
28 asyncTest(() => compiler.libraryLoader.loadLibrary(libraryUri).then((_) { 28 asyncTest(
29 DiagnosticCollector collector = compiler.diagnosticCollector; 29 () => compiler.libraryLoader.loadLibrary(libraryUri).then((libraries) {
30 print('errors: ${collector.errors}'); 30 compiler.processLoadedLibraries(libraries);
31 print('warnings: ${collector.warnings}'); 31 DiagnosticCollector collector = compiler.diagnosticCollector;
32 Expect.isTrue(collector.errors.isEmpty); 32 print('errors: ${collector.errors}');
33 Expect.equals(1, collector.warnings.length); 33 print('warnings: ${collector.warnings}');
34 Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH, 34 Expect.isTrue(collector.errors.isEmpty);
35 collector.warnings.first.messageKind); 35 Expect.equals(1, collector.warnings.length);
36 Expect.equals( 36 Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH,
37 'foo', 37 collector.warnings.first.messageKind);
38 collector.warnings.first.message.arguments['libraryName'] 38 Expect.equals(
39 .toString()); 39 'foo',
40 })); 40 collector.warnings.first.message.arguments['libraryName']
41 .toString());
42 }));
41 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698