OLD | NEW |
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'; |
| 8 |
7 /// Metadata for a test or test suite. | 9 /// Metadata for a test or test suite. |
8 /// | 10 /// |
9 /// 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 |
10 /// configuration from the user. | 12 /// configuration from the user. |
11 class Metadata { | 13 class Metadata { |
12 /// The expressions indicating which platforms the suite supports. | 14 /// The selector indicating which platforms the suite supports. |
13 final String testOn; | 15 final PlatformSelector testOn; |
14 | 16 |
15 Metadata(this.testOn); | 17 /// Creates new Metadata. |
| 18 /// |
| 19 /// [testOn] defaults to [PlatformSelector.all]. |
| 20 Metadata({PlatformSelector testOn}) |
| 21 : testOn = testOn == null ? PlatformSelector.all : testOn; |
| 22 |
| 23 /// Parses metadata fields from strings. |
| 24 /// |
| 25 /// Throws a [FormatException] if any field is invalid. |
| 26 Metadata.parse({String testOn}) |
| 27 : this( |
| 28 testOn: testOn == null ? null : new PlatformSelector.parse(testOn)); |
16 } | 29 } |
OLD | NEW |