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

Unified Diff: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java

Issue 8381018: Expect '{' during class parsing, report error if not. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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
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 93cc1d3c7b23724fc08263044a164df600b2c873..0ab0e5b79c2cce2d6d325b309f5212ffdf28bf61 100644
--- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
@@ -223,6 +223,23 @@ public abstract class CompilerTestCase extends TestCase {
}
/**
+ * Parse a single compilation unit with given name and source, and check for a set of expected errors.
+ *
+ * @param errors a sequence of errors represented as triples of the form
+ * (String msg, int line, int column) or
+ * (ErrorCode code, int line, int column)
+ */
+ protected DartUnit parseSourceUnitErrors(String sourceCode, Object... errors) {
+ String srcName = "Test.dart";
+ DartSourceTest src = new DartSourceTest(srcName, sourceCode, null);
+ DartCompilerListenerTest listener = new DartCompilerListenerTest(srcName, errors);
+ ParserContext context = makeParserContext(src, sourceCode, listener);
+ DartUnit unit = makeParser(context).parseUnit(src);
+ listener.checkAllErrorsReported();
+ return unit;
+ }
+
+ /**
* Parse a single compilation unit for the given input file, and check for a
* set of expected errors.
*

Powered by Google App Engine
This is Rietveld 408576698