Index: test/runner/runner_test.dart |
diff --git a/test/runner/runner_test.dart b/test/runner/runner_test.dart |
index 3e22c3d4c2d3d9f4e4d9bbffa80a197b81da652c..5e038127650cbbd3f78813e7e8c3063de60b3c0f 100644 |
--- a/test/runner/runner_test.dart |
+++ b/test/runner/runner_test.dart |
@@ -377,7 +377,7 @@ void main() { |
expect(result.stdout, contains("+0 ~1: All tests skipped.")); |
}); |
- group("in onPlatform", () { |
+ group("with onPlatform", () { |
test("respects matching Skips", () { |
new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
import 'dart:async'; |
@@ -471,6 +471,81 @@ void main() { |
}); |
}); |
+ group("with an @OnPlatform annotation", () { |
+ test("respects matching Skips", () { |
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
+@OnPlatform(const {"vm": const Skip()}) |
+ |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("fail", () => throw 'oh no'); |
+} |
+'''); |
+ |
+ var result = _runUnittest(["test.dart"]); |
+ expect(result.stdout, contains("+0 ~1: All tests skipped.")); |
+ }); |
+ |
+ test("ignores non-matching Skips", () { |
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
+@OnPlatform(const {"chrome": const Skip()}) |
+ |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("success", () {}); |
+} |
+'''); |
+ |
+ var result = _runUnittest(["test.dart"]); |
+ expect(result.stdout, contains("+1: All tests passed!")); |
+ }); |
+ |
+ test("respects matching Timeouts", () { |
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
+@OnPlatform(const { |
+ "vm": const Timeout(const Duration(seconds: 0)) |
+}) |
+ |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("fail", () => throw 'oh no'); |
+} |
+'''); |
+ |
+ var result = _runUnittest(["test.dart"]); |
+ expect(result.stdout, contains("Test timed out after 0 seconds.")); |
+ expect(result.stdout, contains("-1: Some tests failed.")); |
+ }); |
+ |
+ test("ignores non-matching Timeouts", () { |
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
+@OnPlatform(const { |
+ "chrome": const Timeout(const Duration(seconds: 0)) |
+}) |
+ |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("success", () {}); |
+} |
+'''); |
+ |
+ var result = _runUnittest(["test.dart"]); |
+ expect(result.stdout, contains("+1: All tests passed!")); |
+ }); |
+ }); |
+ |
group("flags:", () { |
test("with the --color flag, uses colors", () { |
new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |