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

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

Issue 8295003: Improve error message for over qualified constructor names. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 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 | « compiler/java/com/google/dart/compiler/parser/DartParser.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java
===================================================================
--- compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java (revision 418)
+++ compiler/javatests/com/google/dart/compiler/parser/ErrorMessageLocationTest.java (working copy)
@@ -15,14 +15,14 @@
*/
public class ErrorMessageLocationTest extends TestCase {
/**
- * Test that unexpected token highlights the correct location in the file.
+ * Test that unexpected token highlights the correct location in the file.
*/
public void testUnexpectedTokenErrorMessage() {
- String sourceCode =
+ String sourceCode =
"// Empty comment\n" +
"interface foo default Bar {\n" +
"}";
-
+
DartParserRunner runner = DartParserRunner.parse(getName(), sourceCode);
List<DartCompilationError> actualErrors = runner.getErrors();
@@ -35,4 +35,24 @@
assertEquals(2, actualError.getLineNumber());
assertEquals(sourceCode.indexOf(errorTokenString), actualError.getStartPosition());
}
+
+ public void testExpectedLeftParenErrorMessage1() {
+ String sourceCode =
+ "// comment to change the line\n" +
+ "main () {\n" +
+ " var x = new PART1.PART2.PART3.PART4();\n" +
+ "}\n";
+
+ DartParserRunner runner = DartParserRunner.parse(getName(), sourceCode);
+ List<DartCompilationError> actualErrors = runner.getErrors();
+
+ // Due to error recovery more than a single error is generated
+ DartCompilationError actualError = actualErrors.get(0);
+
+ String errorTokenString = "PART4";
+ assertEquals(33, actualError.getColumnNumber());
+ assertEquals(errorTokenString.length(), actualError.getLength());
+ assertEquals(3, actualError.getLineNumber());
+ assertEquals(sourceCode.indexOf(errorTokenString), actualError.getStartPosition());
+ }
}
« no previous file with comments | « compiler/java/com/google/dart/compiler/parser/DartParser.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698