Index: test/runner/runner_test.dart |
diff --git a/test/runner/runner_test.dart b/test/runner/runner_test.dart |
index d717b671d62247cc2ec7add3102b85ca989c50f9..0214ab9e4aa2386ece0487b8ae5c40293a6e8d51 100644 |
--- a/test/runner/runner_test.dart |
+++ b/test/runner/runner_test.dart |
@@ -377,6 +377,100 @@ void main() { |
expect(result.stdout, contains("+0 ~1: All tests skipped.")); |
}); |
+ group("in onPlatform", () { |
+ test("respects matching Skips", () { |
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("fail", () => throw 'oh no', onPlatform: {"vm": new Skip()}); |
+} |
+'''); |
+ |
+ 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(''' |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("success", () {}, onPlatform: {"chrome": new Skip()}); |
+} |
+'''); |
+ |
+ 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(''' |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("fail", () => throw 'oh no', onPlatform: { |
+ "vm": new Timeout(new Duration(seconds: 0)) |
+ }); |
+} |
+'''); |
+ |
+ 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(''' |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("success", () {}, onPlatform: { |
+ "chrome": new Timeout(new Duration(seconds: 0)) |
+ }); |
+} |
+'''); |
+ |
+ var result = _runUnittest(["test.dart"]); |
+ expect(result.stdout, contains("+1: All tests passed!")); |
+ }); |
+ |
+ test("applies matching platforms in order", () { |
+ new File(p.join(_sandbox, "test.dart")).writeAsStringSync(''' |
+import 'dart:async'; |
+ |
+import 'package:test/test.dart'; |
+ |
+void main() { |
+ test("success", () {}, onPlatform: { |
+ "vm": new Skip("first"), |
+ "vm || windows": new Skip("second"), |
+ "vm || linux": new Skip("third"), |
+ "vm || mac-os": new Skip("fourth"), |
+ "vm || android": new Skip("fifth") |
+ }); |
+} |
+'''); |
+ |
+ var result = _runUnittest(["test.dart"]); |
+ expect(result.stdout, contains("Skip: fifth")); |
+ expect(result.stdout, isNot(anyOf([ |
+ contains("Skip: first"), |
+ contains("Skip: second"), |
+ contains("Skip: third"), |
+ contains("Skip: fourth") |
+ ]))); |
+ }); |
+ }); |
+ |
group("flags:", () { |
test("with the --color flag, uses colors", () { |
new File(p.join(_sandbox, "test.dart")).writeAsStringSync(_failure); |