| 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());
|
| + }
|
| }
|
|
|