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 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 'mock_compiler.dart'; | 8 import 'mock_compiler.dart'; |
9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
10 show MessageKind; | 10 show MessageKind; |
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 var compiler = new MockCompiler(); | 24 var compiler = new MockCompiler(); |
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 compiler.libraryLoader.loadLibrary(libraryUri, null, libraryUri); | 28 compiler.libraryLoader.loadLibrary(libraryUri, null, libraryUri).then((_) { |
ahe
2013/09/02 15:24:41
Need async guard.
Johnni Winther
2013/09/03 07:51:39
Done.
| |
29 print('errors: ${compiler.errors}'); | 29 print('errors: ${compiler.errors}'); |
30 print('warnings: ${compiler.warnings}'); | 30 print('warnings: ${compiler.warnings}'); |
31 Expect.isTrue(compiler.errors.isEmpty); | 31 Expect.isTrue(compiler.errors.isEmpty); |
32 Expect.equals(1, compiler.warnings.length); | 32 Expect.equals(1, compiler.warnings.length); |
33 Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH, | 33 Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH, |
34 compiler.warnings[0].message.kind); | 34 compiler.warnings[0].message.kind); |
35 Expect.equals('foo', | 35 Expect.equals('foo', |
36 compiler.warnings[0].message.arguments['libraryName'].toString()); | 36 compiler.warnings[0].message.arguments['libraryName'].toString()); |
37 }); | |
37 } | 38 } |
OLD | NEW |