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

Unified Diff: tests/compiler/dart2js/part_of_test.dart

Issue 11879039: Fix error message for library name mismatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/part_of_test.dart
diff --git a/tests/compiler/dart2js/part_of_test.dart b/tests/compiler/dart2js/part_of_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..54c0bc945b464ddd6d2d5c23d1047ec2ec8db5c6
--- /dev/null
+++ b/tests/compiler/dart2js/part_of_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library part_of_test;
+
+import 'dart:uri';
+import 'mock_compiler.dart';
+import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
+ show MessageKind;
+
+final libraryUri = new Uri('test:library.dart');
+const String LIBRARY_SOURCE = '''
+library foo;
+part 'part.dart';
+''';
+
+final partUri = new Uri('test:part.dart');
+const String PART_SOURCE = '''
+part of bar;
+''';
+
+void main() {
+ var compiler = new MockCompiler();
+ compiler.registerSource(libraryUri, LIBRARY_SOURCE);
+ compiler.registerSource(partUri, PART_SOURCE);
+
+ compiler.libraryLoader.loadLibrary(libraryUri, null, libraryUri);
+ print('errors: ${compiler.errors}');
+ print('warnings: ${compiler.warnings}');
+ Expect.isTrue(compiler.errors.isEmpty);
+ Expect.equals(1, compiler.warnings.length);
+ Expect.equals(MessageKind.LIBRARY_NAME_MISMATCH,
+ compiler.warnings[0].message.kind);
+ Expect.equals("${MessageKind.LIBRARY_NAME_MISMATCH.error(['foo'])}",
+ compiler.warnings[0].message.toString());
+}
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698