Chromium Code Reviews| Index: compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java |
| diff --git a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java |
| index 2af6784d1e870e65b67f17d7beb893e2d2ed4912..24d0cb132ca10952ed6e5e757c93056751308a73 100644 |
| --- a/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java |
| +++ b/compiler/javatests/com/google/dart/compiler/parser/NegativeParserTest.java |
| @@ -5,6 +5,9 @@ |
| package com.google.dart.compiler.parser; |
| import com.google.dart.compiler.CompilerTestCase; |
| +import com.google.dart.compiler.DartCompilerErrorCode; |
| +import com.google.dart.compiler.ast.DartUnit; |
| +import com.google.dart.compiler.ast.DartVisitor; |
| /** |
| * Negative Parser/Syntax tests. |
| @@ -42,4 +45,34 @@ public class NegativeParserTest extends CompilerTestCase { |
| public void testMultipleRedirectionConstructors() { |
| parseExpectErrors("class A { A(x) { } A.foo(this.y) : this(1), this(2); }", 1); |
| } |
| + |
| + public void testIncompleteClassDeclaration_noLBrace() { |
| + String sourceCode = |
| + makeCode( |
| + "// filler filler filler filler filler", |
|
zundel
2011/10/24 19:32:04
I don't think we need this line.
|
| + "class Baz", |
| + "class Foo<T> implements Bar<T> {", |
| + " Foo(T head, Bar<T> tail);", |
| + "}"); |
| + DartUnit unit = |
| + parseSourceUnitErrors( |
| + sourceCode, |
| + DartCompilerErrorCode.EXPECTED_CLASS_DECLARATION_LBRACE.getMessage(), 3, 1); |
| + // there was NPE during this operation |
|
zundel
2011/10/24 19:32:04
The NPE is fixed now, let's remove the comment
|
| + new DartVisitor().accept(unit); |
| + // check structure of AST, top level Baz and Foo expected |
| + assertEquals(2, unit.getTopLevelNodes().size()); |
| + assertEquals( |
| + makeCode( |
| + "// unit Test.dart", |
| + "class Baz {", |
| + "}", |
| + "", |
| + "class Foo<T> implements Bar<T> {", |
| + "", |
| + " Foo(T head, Bar<T> tail) ;", |
| + "}", |
| + ""), |
| + unit.toSource()); |
| + } |
| } |