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

Side by Side Diff: lib/src/backend/metadata.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 unified diff | Download patch
« no previous file with comments | « lib/src/backend/invoker.dart ('k') | lib/src/backend/platform_selector.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library unittest.backend.metadata; 5 library unittest.backend.metadata;
6 6
7 import 'platform_selector.dart'; 7 import 'platform_selector.dart';
8 8
9 /// Metadata for a test or test suite. 9 /// Metadata for a test or test suite.
10 /// 10 ///
11 /// This metadata comes from declarations on the test itself; it doesn't include 11 /// This metadata comes from declarations on the test itself; it doesn't include
12 /// configuration from the user. 12 /// configuration from the user.
13 class Metadata { 13 class Metadata {
14 /// The selector indicating which platforms the suite supports. 14 /// The selector indicating which platforms the suite supports.
15 final PlatformSelector testOn; 15 final PlatformSelector testOn;
16 16
17 /// Creates new Metadata. 17 /// Creates new Metadata.
18 /// 18 ///
19 /// [testOn] defaults to [PlatformSelector.all]. 19 /// [testOn] defaults to [PlatformSelector.all].
20 Metadata({PlatformSelector testOn}) 20 Metadata({PlatformSelector testOn})
21 : testOn = testOn == null ? PlatformSelector.all : testOn; 21 : testOn = testOn == null ? PlatformSelector.all : testOn;
22 22
23 /// Parses metadata fields from strings. 23 /// Parses metadata fields from strings.
24 /// 24 ///
25 /// Throws a [FormatException] if any field is invalid. 25 /// Throws a [FormatException] if any field is invalid.
26 Metadata.parse({String testOn}) 26 Metadata.parse({String testOn})
27 : this( 27 : this(
28 testOn: testOn == null ? null : new PlatformSelector.parse(testOn)); 28 testOn: testOn == null ? null : new PlatformSelector.parse(testOn));
29
30 /// Dezerializes the result of [Metadata.serialize] into a new [Metadata].
31 Metadata.deserialize(serialized)
32 : this.parse(testOn: serialized['testOn']);
33
34 /// Return a new [Metadata] that merges [this] with [other].
35 ///
36 /// If the two [Metadata]s have conflicting properties, [other] wins.
37 Metadata merge(Metadata other) =>
38 new Metadata(testOn: testOn.intersect(other.testOn));
39
40 /// Serializes [this] into a JSON-safe object that can be deserialized using
41 /// [new Metadata.deserialize].
42 serialize() => {
43 'testOn': testOn == PlatformSelector.all ? null : testOn.toString()
44 };
29 } 45 }
OLDNEW
« no previous file with comments | « lib/src/backend/invoker.dart ('k') | lib/src/backend/platform_selector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698