Index: test/runner/runner_test.dart |
diff --git a/test/runner/runner_test.dart b/test/runner/runner_test.dart |
index 002824a966a0ae7c1c891e553a737e966fbf7ecc..478ff77d120815486ad820aae34aaa3d13eaabd4 100644 |
--- a/test/runner/runner_test.dart |
+++ b/test/runner/runner_test.dart |
@@ -2,6 +2,8 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+@TestOn("vm") |
+ |
import 'dart:io'; |
import 'package:path/path.dart' as p; |
@@ -98,6 +100,34 @@ $_usage""")); |
expect(result.exitCode, equals(exit_codes.data)); |
}); |
+ // 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", () { |
+ var testPath = p.join(_sandbox, "test.dart"); |
+ new File(testPath).writeAsStringSync("@TestOn)"); |
+ var result = _runUnittest(["test.dart"]); |
+ |
+ expect(result.stderr, equals( |
+ 'Failed to load "${p.relative(testPath, from: _sandbox)}":\n' |
+ "line 1 pos 8: unexpected token ')'\n" |
+ "@TestOn)\n" |
+ " ^\n")); |
+ expect(result.exitCode, equals(exit_codes.data)); |
+ }); |
+ |
+ test("an annotation's structure is invalid", () { |
+ var testPath = p.join(_sandbox, "test.dart"); |
+ new File(testPath).writeAsStringSync("@TestOn()\nlibrary foo;"); |
+ var result = _runUnittest(["test.dart"]); |
+ |
+ expect(result.stderr, equals( |
+ 'Failed to load "${p.relative(testPath, from: _sandbox)}":\n' |
+ "Error on line 1, column 8: TestOn takes one argument.\n" |
+ "@TestOn()\n" |
+ " ^^\n")); |
+ expect(result.exitCode, equals(exit_codes.data)); |
+ }); |
+ |
test("a test file throws", () { |
var testPath = p.join(_sandbox, "test.dart"); |
new File(testPath).writeAsStringSync("void main() => throw 'oh no';"); |