Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java

Issue 9052002: Issue 999: NPE from CompileTimeConstantAnalyzer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup of ErrorExpectation + static imports Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a1aa7973bb655a1aeaebb00a6683b23f29baba56..ad19870795fc4fa63fa87845df0ce54204ef7834 100644
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java
@@ -19,6 +19,7 @@ import com.google.dart.compiler.ast.DartTypeParameter;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.ast.Modifiers;
+import com.google.dart.compiler.common.ErrorExpectation;
import com.google.dart.compiler.parser.DartParser;
import com.google.dart.compiler.parser.DartScannerParserContext;
import com.google.dart.compiler.testing.TestCompilerContext;
@@ -462,4 +463,27 @@ abstract class ResolverTestCase extends TestCase {
checkExpectedErrors(resolveErrors, errorCodes, source);
return resolveErrors;
}
+
+ protected List<DartCompilationError> resolveAndTestCtConstExpectErrors(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
+ resolveCompileTimeConst(unit, ctx);
+ ErrorExpectation.assertErrors(resolveErrors, expectedErrors);
+ return resolveErrors;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698