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

Unified Diff: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java

Issue 11416307: Triage and fixes for co19 library tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « compiler/java/com/google/dart/compiler/parser/DartScanner.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
index 7ef53ab4bebd82ddb4a4406a6530f2f4ec8e3d72..157cb23650d3d476bfdcd977fd5ba951f992a753 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
package com.google.dart.compiler.end2end.inc;
+import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -641,6 +642,130 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
}
/**
+ * Checks that it is a compile-time error when a library directly imports two other libraries that
+ * have the same library name.
+ */
+ public void test_importTwoLibraries_withSameName() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library duplicate_name;",
+ ""));
+ appSource.setContent(
+ "B.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library duplicate_name;",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.app;",
+ "import 'A.dart';",
+ "import 'B.dart';",
+ "main() {",
+ "}",
+ ""));
+ compile();
+ assertErrors(
+ errors,
+ errEx(APP, DartCompilerErrorCode.DUPLICATE_IMPORTED_LIBRARY_NAME, 4, 1, 16));
+ }
+
+ /**
+ * Checks valid library definitions with metadata.
+ */
+ public void test_importLibrary_withMetaBeforeLibraryDirective() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "@meta library A;",
+ "const int meta = 1;",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.app;",
+ "import 'A.dart';",
+ ""));
+ compile();
+ assertErrors(errors);
+ }
+
+ /**
+ * Checks that it is not an error to use a multi-line string literal as a URI in a part directive.
+ * Even with leading whitespace since it's getting trimmed. Even with Windows \r\n style.
+ */
+ public void test_importLibrary_multiLineStringUri() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library A;",
+ "var foo;",
+ ""));
+ appSource.setContent(
+ APP,
+ Joiner.on("\r\n").join(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library app;",
+ "import '''",
+ "A.dart''';",
+ "main() {",
+ " foo;",
+ "}",
+ ""));
+ compile();
+ assertErrors(errors);
+ }
+
+ /**
+ * Checks that it is a compile-time error when the library being exported does not have a library
+ * definition.
+ */
+ public void test_exportLibrary_withoutLibraryDirective() throws Exception {
+ appSource.setContent("A.dart", "");
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library test.app;",
+ "export 'A.dart';",
+ ""));
+ compile();
+ assertErrors(
+ errors,
+ errEx(APP, DartCompilerErrorCode.MISSING_LIBRARY_DIRECTIVE_EXPORT, 3, 1, 16));
+ }
+
+ /**
+ * Enabled in 0.13
+ */
+ public void test_exportLibrary_fromScript() throws Exception {
+ appSource.setContent(
+ "A.dart",
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library A;",
+ ""));
+ appSource.setContent(
+ APP,
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "library myScript;",
+ "export 'A.dart';",
+ "main() {",
+ "}",
+ ""));
+ compile();
+ assertErrors(errors);
+ }
+
+ /**
* It is neither an error nor a warning if N is introduced by two or more imports but never
* referred to.
*/
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/DartScanner.java ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698