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

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

Issue 1027193004: Respect top-level @TestOn declarations. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Add another test. 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
Index: lib/src/backend/metadata.dart
diff --git a/lib/src/backend/metadata.dart b/lib/src/backend/metadata.dart
index 738a7cf5e692457fee3d5a72ff9c5c28aedeaf97..d567a27c9d5c3d0778cdacc7451ffa1498fcb576 100644
--- a/lib/src/backend/metadata.dart
+++ b/lib/src/backend/metadata.dart
@@ -4,13 +4,26 @@
library unittest.backend.metadata;
+import 'platform_selector.dart';
+
/// Metadata for a test or test suite.
///
/// This metadata comes from declarations on the test itself; it doesn't include
/// configuration from the user.
class Metadata {
- /// The expressions indicating which platforms the suite supports.
- final String testOn;
+ /// The selector indicating which platforms the suite supports.
+ final PlatformSelector testOn;
+
+ /// Creates new Metadata.
+ ///
+ /// [testOn] defaults to [PlatformSelector.all].
+ Metadata({PlatformSelector testOn})
+ : testOn = testOn == null ? PlatformSelector.all : testOn;
- Metadata(this.testOn);
+ /// Parses metadata fields from strings.
+ ///
+ /// Throws a [FormatException] if any field is invalid.
+ Metadata.parse({String testOn})
+ : this(
+ testOn: testOn == null ? null : new PlatformSelector.parse(testOn));
}

Powered by Google App Engine
This is Rietveld 408576698