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.suite; | 5 library unittest.backend.suite; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
| 9 import 'metadata.dart'; |
9 import 'test.dart'; | 10 import 'test.dart'; |
10 | 11 |
11 /// A test suite. | 12 /// A test suite. |
12 /// | 13 /// |
13 /// A test suite is a set of tests that are intended to be run together and that | 14 /// A test suite is a set of tests that are intended to be run together and that |
14 /// share default configuration. | 15 /// share default configuration. |
15 class Suite { | 16 class Suite { |
16 /// A description of the platform on which the suite is running, or `null` if | 17 /// A description of the platform on which the suite is running, or `null` if |
17 /// that platform is unknown. | 18 /// that platform is unknown. |
18 final String platform; | 19 final String platform; |
19 | 20 |
20 /// The path to the Dart test suite, or `null` if that path is unknown. | 21 /// The path to the Dart test suite, or `null` if that path is unknown. |
21 final String path; | 22 final String path; |
22 | 23 |
| 24 /// The metadata associated with this test suite. |
| 25 final Metadata metadata; |
| 26 |
23 /// The tests in the test suite. | 27 /// The tests in the test suite. |
24 final List<Test> tests; | 28 final List<Test> tests; |
25 | 29 |
26 Suite(Iterable<Test> tests, {String path, String platform}) | 30 Suite(Iterable<Test> tests, {this.path, this.platform, Metadata metadata}) |
27 : path = path, | 31 : metadata = metadata == null ? new Metadata() : metadata, |
28 platform = platform, | |
29 tests = new UnmodifiableListView<Test>(tests.toList()); | 32 tests = new UnmodifiableListView<Test>(tests.toList()); |
| 33 |
| 34 /// Returns a new suite with the given fields updated. |
| 35 Suite change({String path, String platform, Metadata metadata, |
| 36 Iterable<Test> tests}) { |
| 37 if (path == null) path = this.path; |
| 38 if (platform == null) platform = this.platform; |
| 39 if (metadata == null) metadata = this.metadata; |
| 40 if (tests == null) tests = this.tests; |
| 41 return new Suite(tests, path: path, platform: platform, metadata: metadata); |
| 42 } |
30 } | 43 } |
OLD | NEW |