OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'configuration.dart'; | |
6 import 'environment.dart'; | |
7 import 'expectation.dart'; | 5 import 'expectation.dart'; |
8 import 'status_file.dart'; | 6 import 'status_file.dart'; |
9 | 7 |
10 /// Tracks the [Expectation]s associated with a set of file paths. | 8 /// Tracks the [Expectation]s associated with a set of file paths. |
11 /// | 9 /// |
12 /// For any given file path, returns the expected test results for that file. | 10 /// For any given file path, returns the expected test results for that file. |
13 /// A set can be loaded from a collection of status files. A file path may | 11 /// A set can be loaded from a collection of status files. A file path may |
14 /// exist in multiple files (or even multiple sections within the file). When | 12 /// exist in multiple files (or even multiple sections within the file). When |
15 /// that happens, all of the expectations of every entry are combined. | 13 /// that happens, all of the expectations of every entry are combined. |
16 class ExpectationSet { | 14 class ExpectationSet { |
17 /// Reads the expectations defined by the status files at [statusFilePaths] | 15 /// Reads the expectations defined by the status files at [statusFilePaths] |
18 /// when in [configuration]. | 16 /// given [environment]. |
19 static ExpectationSet read( | 17 static ExpectationSet read( |
20 List<String> statusFilePaths, Configuration configuration) { | 18 List<String> statusFilePaths, Map<String, dynamic> environment) { |
21 var environment = new Environment(configuration); | |
22 var expectations = new ExpectationSet._(); | 19 var expectations = new ExpectationSet._(); |
23 for (var path in statusFilePaths) { | 20 for (var path in statusFilePaths) { |
24 var file = new StatusFile.read(path); | 21 var file = new StatusFile.read(path); |
25 for (var section in file.sections) { | 22 for (var section in file.sections) { |
26 if (section.isEnabled(environment)) { | 23 if (section.isEnabled(environment)) { |
27 for (var entry in section.entries) { | 24 for (var entry in section.entries) { |
28 expectations.addEntry(entry); | 25 expectations.addEntry(entry); |
29 } | 26 } |
30 } | 27 } |
31 } | 28 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 var component = splitKey[i]; | 109 var component = splitKey[i]; |
113 var regExp = regExpCache.putIfAbsent(component, | 110 var regExp = regExpCache.putIfAbsent(component, |
114 () => new RegExp("^${splitKey[i]}\$".replaceAll('*', '.*'))); | 111 () => new RegExp("^${splitKey[i]}\$".replaceAll('*', '.*'))); |
115 regExps[i] = regExp; | 112 regExps[i] = regExp; |
116 } | 113 } |
117 | 114 |
118 _keyToRegExps[key] = regExps; | 115 _keyToRegExps[key] = regExps; |
119 }); | 116 }); |
120 } | 117 } |
121 } | 118 } |
OLD | NEW |