| Index: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
|
| index 86e6c482246304e7a4aa27541a711d1ba715f16f..b9edb10098593c6326ee54b20be57c19b054cc74 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
|
| @@ -251,7 +251,27 @@ public abstract class CompilerTestCase extends TestCase {
|
| return unit;
|
| }
|
|
|
| - protected DartUnit parseUnitAsSystemLibrary(final String srcName, String sourceCode,
|
| + /**
|
| + * Parse a single compilation unit for the name and source. The parse expects some kind of error,
|
| + * but isn't picky about the actual contents. This is useful for testing parser recovery where we
|
| + * don't want to make the test too brittle.
|
| + */
|
| + protected DartUnit parseUnitUnspecifiedErrors(String srcName, String sourceCode) {
|
| + DartSourceTest src = new DartSourceTest(srcName, sourceCode, null);
|
| + final List<DartCompilationError> errorsEncountered = Lists.newArrayList();
|
| + DartCompilerListener listener = new DartCompilerListener.Empty() {
|
| + @Override
|
| + public void onError(DartCompilationError event) {
|
| + errorsEncountered.add(event);
|
| + }
|
| + };
|
| + ParserContext context = makeParserContext(src, sourceCode, listener);
|
| + DartUnit unit = makeParser(context).parseUnit(src);
|
| + assertTrue("Expected some compilation errors, got none.", errorsEncountered.size() > 0);
|
| + return unit;
|
| + }
|
| +
|
| + protected DartUnit parseUnitAsSystemLibrary(final String srcName, String sourceCode,
|
| Object... errors) {
|
| DartSourceTest src = new DartSourceTest(srcName, sourceCode, null) {
|
| @Override
|
|
|