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