| 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 c983d061327f09395f4ed8e20517b574ded83047..3c2cd900ba6edcd21be9322fa86c20cc1e1d269b 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
|
| @@ -9,6 +9,7 @@ import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
|
| import com.google.dart.compiler.ast.DartUnit;
|
| import com.google.dart.compiler.ast.LibraryUnit;
|
| import com.google.dart.compiler.parser.DartParser;
|
| +import com.google.dart.compiler.parser.DartParserRunner;
|
| import com.google.dart.compiler.parser.DartScannerParserContext;
|
| import com.google.dart.compiler.parser.ParserContext;
|
|
|
| @@ -274,6 +275,22 @@ public abstract class CompilerTestCase extends TestCase {
|
| return new DartScannerParserContext(src, sourceCode, listener);
|
| }
|
|
|
| + /**
|
| + * @return the {@link DartParserRunner} with parsed source. It can be used to request
|
| + * {@link DartUnit} or compilation problems.
|
| + */
|
| + protected final DartParserRunner parseSource(String code) {
|
| + return DartParserRunner.parse(getName(), code, Integer.MAX_VALUE, false);
|
| + }
|
| +
|
| + /**
|
| + * Parses given source and checks parsing problems.
|
| + */
|
| + protected final void parseExpectErrors(String code, ErrorExpectation... expectedErrors) {
|
| + List<DartCompilationError> errors = parseSource(code).getErrors();
|
| + assertErrors(errors, expectedErrors);
|
| + }
|
| +
|
| protected static class ErrorExpectation {
|
| final ErrorCode errorCode;
|
| final int line;
|
|
|