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

Unified Diff: lib/src/backend/suite.dart

Issue 1036943002: Add a testOn parameter to test() and group(). (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 9 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/backend/platform_selector.dart ('k') | lib/src/backend/test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/suite.dart
diff --git a/lib/src/backend/suite.dart b/lib/src/backend/suite.dart
index 584ae9a10d61d2e983d7817137f52a3bb334e7e0..e622123fd1ba9132318a9544c04302326ce514ba 100644
--- a/lib/src/backend/suite.dart
+++ b/lib/src/backend/suite.dart
@@ -7,7 +7,9 @@ library unittest.backend.suite;
import 'dart:collection';
import 'metadata.dart';
+import 'operating_system.dart';
import 'test.dart';
+import 'test_platform.dart';
/// A test suite.
///
@@ -31,6 +33,17 @@ class Suite {
: metadata = metadata == null ? new Metadata() : metadata,
tests = new UnmodifiableListView<Test>(tests.toList());
+ /// Returns a new suite that only contains tests that are valid for the given
+ /// [platform] and [os].
+ ///
+ /// If the suite itself is invalid for [platform] and [os], returns `null`.
+ Suite filter(TestPlatform platform, {OperatingSystem os}) {
+ if (!metadata.testOn.evaluate(platform, os: os)) return null;
+ return change(tests: tests.where((test) {
+ return test.metadata.testOn.evaluate(platform, os: os);
+ }));
+ }
+
/// Returns a new suite with the given fields updated.
Suite change({String path, String platform, Metadata metadata,
Iterable<Test> tests}) {
« no previous file with comments | « lib/src/backend/platform_selector.dart ('k') | lib/src/backend/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698