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)); |
} |