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 6d789f330c59298fe482fd1bed795eb8af1b7ee1..c41d3a93773f6345eec25bea4582715c89184ad8 100644 |
--- a/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java |
+++ b/compiler/javatests/com/google/dart/compiler/resolver/ResolverTestCase.java |
@@ -400,4 +400,31 @@ abstract class ResolverTestCase extends TestCase { |
resolve(unit, ctx); |
checkExpectedErrors(encountered, errorCodes, source); |
} |
+ |
+ /** |
+ * Convenience method to parse and resolve a code snippet, without checking errors. |
+ */ |
+ protected void resolve(String source) { |
+ TestCompilerContext ctx = new TestCompilerContext() { |
+ @Override |
+ public void compilationError(DartCompilationError event) { |
+ } |
+ }; |
+ DartUnit unit = parseUnit(source); |
+ resolve(unit, ctx); |
+ } |
+ |
+ /** |
+ * Build a multi-line string from a list of strings. |
+ * |
+ * @param lines |
+ * @return a single string containing {@code lines}, each terminated by \n |
+ */ |
+ protected static String makeCode(String... lines) { |
+ StringBuilder buf = new StringBuilder(); |
+ for (String line : lines) { |
+ buf.append(line).append('\n'); |
+ } |
+ return buf.toString(); |
+ } |
} |