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

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

Issue 1093633004: Add test- and group-level support for skipping tests. (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 | « lib/src/backend/declarer.dart ('k') | lib/src/runner/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
};
}
« no previous file with comments | « lib/src/backend/declarer.dart ('k') | lib/src/runner/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698