| Index: compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
|
| diff --git a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
|
| index 7bb3c8bd2e00069856697a44460625a23283ecf4..f5e6afda0ad32202ddfc8a4871786871c4c80d85 100644
|
| --- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
|
| +++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
|
| @@ -449,7 +449,12 @@ abstract class ResolverTestCase extends TestCase {
|
| *
|
| * @return resolve errors.
|
| */
|
| - protected List<DartCompilationError> resolveAndTest(String source, ErrorCode... errorCodes) {
|
| + protected List<DartCompilationError> resolveAndTest(String source, ErrorCode errorCode, ErrorCode... errorCodeRest) {
|
| + ErrorCode errorCodes[] = new ErrorCode[errorCodeRest.length + 1];
|
| + errorCodes[0] = errorCode;
|
| + if (errorCodeRest.length > 0) {
|
| + System.arraycopy(errorCodeRest, 0, errorCodes, 1, errorCodeRest.length);
|
| + }
|
| // parse DartUnit
|
| DartUnit unit = parseUnit(source);
|
| if (parseErrors.size() != 0) {
|
| @@ -471,6 +476,30 @@ abstract class ResolverTestCase extends TestCase {
|
| checkExpectedErrors(resolveErrors, errorCodes, source);
|
| return resolveErrors;
|
| }
|
| +
|
| + protected List<DartCompilationError> resolveAndTest(String source,
|
| + ErrorExpectation... expectedErrors) {
|
| + // parse DartUnit
|
| + DartUnit unit = parseUnit(source);
|
| + if (parseErrors.size() != 0) {
|
| + printSource(source);
|
| + printEncountered(parseErrors);
|
| + assertEquals("Expected no errors in parse step:", 0, parseErrors.size());
|
| + }
|
| + // prepare for recording resolving errors
|
| + resetParseErrors();
|
| + final List<DartCompilationError> resolveErrors = Lists.newArrayList();
|
| + TestCompilerContext ctx = new TestCompilerContext() {
|
| + @Override
|
| + public void onError(DartCompilationError event) {
|
| + resolveErrors.add(event);
|
| + }
|
| + };
|
| + // resolve and check errors
|
| + resolve(unit, ctx);
|
| + ErrorExpectation.assertErrors(resolveErrors, expectedErrors);
|
| + return resolveErrors;
|
| + }
|
|
|
| /**
|
| * Convenience method to parse and resolve a code snippet, then test for error codes.
|
|
|