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

Unified Diff: test/runner/runner_test.dart

Issue 1172213002: Improve the capture and display of syntax errors in VM tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 6 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 | « lib/src/runner/vm/isolate_listener.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/runner_test.dart
diff --git a/test/runner/runner_test.dart b/test/runner/runner_test.dart
index 21794bb4fe9c846905b6af3f1d965aef5d0ed5e5..5178d915e67f787bbe2e59e94521694df9b4744d 100644
--- a/test/runner/runner_test.dart
+++ b/test/runner/runner_test.dart
@@ -132,6 +132,24 @@ $_usage"""));
expect(result.exitCode, equals(1));
});
+ // This syntax error is detected lazily, and so requires some extra
+ // machinery to support.
+ test("a test file fails to parse due to a missing semicolon", () {
+ var testPath = p.join(_sandbox, "test.dart");
+ new File(testPath).writeAsStringSync("void main() {foo}");
+ var result = _runTest(["test.dart"]);
+
+ expect(result.stdout, allOf([
+ contains('-1: load error'),
+ contains(
+ ' Failed to load "${p.relative(testPath, from: _sandbox)}":\n'
+ " line 1 pos 17: semicolon expected\n"
+ " void main() {foo}\n"
+ " ^\n")
+ ]));
+ expect(result.exitCode, equals(1));
+ });
+
// This is slightly different from the above test because it's an error
// that's caught first by the analyzer when it's used to parse the file.
test("a test file fails to parse", () {
« no previous file with comments | « lib/src/runner/vm/isolate_listener.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698