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

Unified Diff: test/runner/browser/runner_test.dart

Issue 1092153003: Support an @OnPlatform annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 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 | « test/backend/metadata_test.dart ('k') | test/runner/parse_metadata_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/browser/runner_test.dart
diff --git a/test/runner/browser/runner_test.dart b/test/runner/browser/runner_test.dart
index 146c05fd5c7ab90e6d7c54456f4c67944038c112..d4173215416cc380d6ba44c02390d330933190f3 100644
--- a/test/runner/browser/runner_test.dart
+++ b/test/runner/browser/runner_test.dart
@@ -514,7 +514,7 @@ void main() {
expect(result.stdout, contains("-1: Some tests failed."));
});
- group("in onPlatform", () {
+ group("with onPlatform", () {
test("respects matching Skips", () {
new File(p.join(_sandbox, "test.dart")).writeAsStringSync('''
import 'dart:async';
@@ -607,6 +607,81 @@ void main() {
])));
});
});
+
+ group("with an @OnPlatform annotation", () {
+ test("respects 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("fail", () => throw 'oh no');
+}
+''');
+
+ var result = _runUnittest(["-p", "chrome", "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 {"vm": const Skip()})
+
+import 'dart:async';
+
+import 'package:test/test.dart';
+
+void main() {
+ test("success", () {});
+}
+''');
+
+ var result = _runUnittest(["-p", "chrome", "test.dart"]);
+ expect(result.stdout, contains("+1: All tests passed!"));
+ });
+
+ test("respects 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("fail", () => throw 'oh no');
+}
+''');
+
+ var result = _runUnittest(["-p", "chrome", "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 {
+ "vm": const Timeout(const Duration(seconds: 0))
+})
+
+import 'dart:async';
+
+import 'package:test/test.dart';
+
+void main() {
+ test("success", () {});
+}
+''');
+
+ var result = _runUnittest(["-p", "chrome", "test.dart"]);
+ expect(result.stdout, contains("+1: All tests passed!"));
+ });
+ });
}
ProcessResult _runUnittest(List<String> args) =>
« no previous file with comments | « test/backend/metadata_test.dart ('k') | test/runner/parse_metadata_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698