| Index: lib/src/backend/metadata.dart
|
| diff --git a/lib/src/backend/metadata.dart b/lib/src/backend/metadata.dart
|
| index f745b28e85f7ecd23265b831625259e49955cc3d..ecce4404601c0f59672c6a64e411d9409c09b7f8 100644
|
| --- a/lib/src/backend/metadata.dart
|
| +++ b/lib/src/backend/metadata.dart
|
| @@ -18,21 +18,37 @@ class Metadata {
|
| /// The modification to the timeout for the test or suite.
|
| final Timeout timeout;
|
|
|
| + /// Whether the test or suite should be skipped.
|
| + final bool skip;
|
| +
|
| + /// The reason the test or suite should be skipped, if given.
|
| + final String skipReason;
|
| +
|
| /// Creates new Metadata.
|
| ///
|
| /// [testOn] defaults to [PlatformSelector.all].
|
| - Metadata({PlatformSelector testOn, Timeout timeout})
|
| + Metadata({PlatformSelector testOn, Timeout timeout, bool skip: false,
|
| + this.skipReason})
|
| : testOn = testOn == null ? PlatformSelector.all : testOn,
|
| - timeout = timeout == null ? const Timeout.factor(1) : timeout;
|
| + timeout = timeout == null ? const Timeout.factor(1) : timeout,
|
| + skip = skip;
|
|
|
| /// Creates a new Metadata, but with fields parsed from strings where
|
| /// applicable.
|
| ///
|
| /// Throws a [FormatException] if any field is invalid.
|
| - Metadata.parse({String testOn, Timeout timeout})
|
| - : this(
|
| - testOn: testOn == null ? null : new PlatformSelector.parse(testOn),
|
| - timeout: timeout);
|
| + Metadata.parse({String testOn, Timeout timeout, skip})
|
| + : testOn = testOn == null
|
| + ? PlatformSelector.all
|
| + : new PlatformSelector.parse(testOn),
|
| + timeout = timeout == null ? const Timeout.factor(1) : timeout,
|
| + skip = skip != null && skip != false,
|
| + skipReason = skip is String ? skip : null {
|
| + if (skip != null && skip is! String && skip is! bool) {
|
| + throw new ArgumentError(
|
| + '"skip" must be a String or a bool, was "$skip".');
|
| + }
|
| + }
|
|
|
| /// Dezerializes the result of [Metadata.serialize] into a new [Metadata].
|
| Metadata.deserialize(serialized)
|
| @@ -41,7 +57,10 @@ class Metadata {
|
| timeout: serialized['timeout']['duration'] == null
|
| ? new Timeout.factor(serialized['timeout']['scaleFactor'])
|
| : new Timeout(new Duration(
|
| - microseconds: serialized['timeout']['duration'])));
|
| + microseconds: serialized['timeout']['duration'])),
|
| + skip: serialized['skipReason'] == null
|
| + ? serialized['skip']
|
| + : serialized['skipReason']);
|
|
|
| /// Return a new [Metadata] that merges [this] with [other].
|
| ///
|
| @@ -49,7 +68,9 @@ class Metadata {
|
| Metadata merge(Metadata other) =>
|
| new Metadata(
|
| testOn: testOn.intersect(other.testOn),
|
| - timeout: timeout.merge(other.timeout));
|
| + timeout: timeout.merge(other.timeout),
|
| + skip: skip || other.skip,
|
| + skipReason: other.skipReason == null ? skipReason : other.skipReason);
|
|
|
| /// Serializes [this] into a JSON-safe object that can be deserialized using
|
| /// [new Metadata.deserialize].
|
| @@ -60,6 +81,8 @@ class Metadata {
|
| ? null
|
| : timeout.duration.inMicroseconds,
|
| 'scaleFactor': timeout.scaleFactor
|
| - }
|
| + },
|
| + 'skip': skip,
|
| + 'skipReason': skipReason
|
| };
|
| }
|
|
|