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

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

Issue 9860051: Dartc erroneously reported a compile-time error on a const class with a non-final static field (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added documentation to test case Created 8 years, 9 months 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
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « compiler/javatests/com/google/dart/compiler/resolver/ResolverTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698