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

Unified Diff: compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java

Issue 10825346: Fix bugs in parser and update tests to use new directive syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
Index: compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java (revision 10652)
+++ compiler/javatests/com/google/dart/compiler/parser/ParserRecoveryTest.java (working copy)
@@ -760,10 +760,10 @@
public void testRecoveryDirective1() {
DartUnit unit = parseUnit("phony_recovery_directive1.dart",
Joiner.on("\n").join(
- "#library('a');",
- "#library('b');"),
+ "library a;",
+ "library b;"),
ParserErrorCode.DIRECTIVE_OUT_OF_ORDER, 2, 1,
- ParserErrorCode.ONLY_ONE_LIBRARY_DIRECTIVE, 2, 14);
+ ParserErrorCode.ONLY_ONE_LIBRARY_DIRECTIVE, 2, 10);
DartLibraryDirective a = (DartLibraryDirective)unit.getDirectives().get(0);
assertEquals("a", a.getLibraryName());
DartLibraryDirective b = (DartLibraryDirective)unit.getDirectives().get(1);
@@ -773,8 +773,8 @@
public void testRecoveryDirective2() {
DartUnit unit = parseUnit("phony_recovery_directive2.dart",
Joiner.on("\n").join(
- "#import('a');",
- "#library('b');"),
+ "import 'a';",
+ "library b;"),
ParserErrorCode.DIRECTIVE_OUT_OF_ORDER, 2, 1);
DartImportDirective a = (DartImportDirective)unit.getDirectives().get(0);
assertEquals("a", a.getLibraryUri().getValue());
@@ -785,8 +785,8 @@
public void testRecoveryDirective3() {
DartUnit unit = parseUnit("phony_recovery_directive3.dart",
Joiner.on("\n").join(
- "#source('a');",
- "#import('b');"),
+ "part 'a';",
+ "import 'b';"),
ParserErrorCode.DIRECTIVE_OUT_OF_ORDER, 2, 1);
DartSourceDirective a = (DartSourceDirective)unit.getDirectives().get(0);
assertEquals("a", a.getSourceUri().getValue());
@@ -797,35 +797,21 @@
public void testRecoveryDirective4() {
DartUnit unit = parseUnit("phony_recovery_directive4.dart",
Joiner.on("\n").join(
- "#import('a')", // missing semicolon
- "#import('b');"),
- ParserErrorCode.EXPECTED_TOKEN, 2, 1);
+ "import 'a'", // missing semicolon
+ "import 'b';"),
+ ParserErrorCode.EXPECTED_TOKEN, 1, 8);
DartImportDirective a = (DartImportDirective)unit.getDirectives().get(0);
assertEquals("a", a.getLibraryUri().getValue());
DartImportDirective b = (DartImportDirective)unit.getDirectives().get(1);
assertEquals("b", b.getLibraryUri().getValue());
}
- public void testRecoveryDirective5() {
- DartUnit unit = parseUnit("phony_recovery_directive5.dart",
- Joiner.on("\n").join(
- "#import('a'", // missing paren and semicolon
- "#import('b');"),
- ParserErrorCode.EXPECTED_TOKEN, 1, 9,
- ParserErrorCode.EXPECTED_TOKEN, 2, 1);
- DartImportDirective a = (DartImportDirective)unit.getDirectives().get(0);
- assertEquals("a", a.getLibraryUri().getValue());
- DartImportDirective b = (DartImportDirective)unit.getDirectives().get(1);
- assertEquals("b", b.getLibraryUri().getValue());
- }
-
public void testRecoveryDirective6() {
DartUnit unit = parseUnit("phony_recovery_directive6.dart",
Joiner.on("\n").join(
- "#import('a'", // missing paren and semicolon
+ "import 'a'", // missing semicolon
"class b {}"),
- ParserErrorCode.EXPECTED_TOKEN, 1, 9,
- ParserErrorCode.EXPECTED_TOKEN, 2, 1);
+ ParserErrorCode.EXPECTED_TOKEN, 1, 8);
DartImportDirective a = (DartImportDirective)unit.getDirectives().get(0);
assertEquals("a", a.getLibraryUri().getValue());
DartClass b = (DartClass)unit.getTopLevelNodes().get(0);

Powered by Google App Engine
This is Rietveld 408576698