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 test.runner; | 5 library test.runner; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:async/async.dart'; | 10 import 'package:async/async.dart'; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return mergeStreams(_config.paths.map((path) { | 151 return mergeStreams(_config.paths.map((path) { |
152 if (new Directory(path).existsSync()) return _loader.loadDir(path); | 152 if (new Directory(path).existsSync()) return _loader.loadDir(path); |
153 if (new File(path).existsSync()) return _loader.loadFile(path); | 153 if (new File(path).existsSync()) return _loader.loadFile(path); |
154 | 154 |
155 return new Stream.fromIterable([ | 155 return new Stream.fromIterable([ |
156 new LoadSuite("loading $path", () => | 156 new LoadSuite("loading $path", () => |
157 throw new LoadException(path, 'Does not exist.')) | 157 throw new LoadException(path, 'Does not exist.')) |
158 ]); | 158 ]); |
159 })).map((loadSuite) { | 159 })).map((loadSuite) { |
160 return loadSuite.changeSuite((suite) { | 160 return loadSuite.changeSuite((suite) { |
161 return suite.filter((test) => | 161 return suite.filter((test) { |
162 (_config.pattern == null || test.name.contains(_config.pattern)) && | 162 bool matchesNamePattern = |
163 (_config.tags.isEmpty || intersect(_config.tags, test.metadata.tags)
)); | 163 _config.pattern == null || test.name.contains(_config.pattern); |
| 164 bool matchesTags = _config.tags.isEmpty || |
| 165 intersect(_config.tags, test.metadata.tags); |
| 166 bool matchesExcludeTags = |
| 167 intersect(_config.excludeTags, test.metadata.tags); |
| 168 |
| 169 var specifiedTags = _config.tags.union(_config.excludeTags); |
| 170 List unrecognizedTags = test.metadata.tags.difference(specifiedTags); |
| 171 if (unrecognizedTags.isNotEmpty) { |
| 172 var yellow = _config.color ? '\u001b[33m' : ''; |
| 173 stderr.writeln("\n${yellow}WARNING: unrecognized tags ${unrecognized
Tags} in test '${test.name}'"); |
| 174 } |
| 175 |
| 176 return matchesNamePattern && matchesTags && !matchesExcludeTags; |
| 177 }); |
164 }); | 178 }); |
165 }); | 179 }); |
166 } | 180 } |
167 | 181 |
168 /// Loads each suite in [suites] in order, pausing after load for platforms | 182 /// Loads each suite in [suites] in order, pausing after load for platforms |
169 /// that support debugging. | 183 /// that support debugging. |
170 Future<bool> _loadThenPause(Stream<LoadSuite> suites) async { | 184 Future<bool> _loadThenPause(Stream<LoadSuite> suites) async { |
171 if (_config.platforms.contains(TestPlatform.vm)) { | 185 if (_config.platforms.contains(TestPlatform.vm)) { |
172 warn("Debugging is currently unsupported on the Dart VM.", | 186 warn("Debugging is currently unsupported on the Dart VM.", |
173 color: _config.color); | 187 color: _config.color); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 261 |
248 await inCompletionOrder([ | 262 await inCompletionOrder([ |
249 suite.environment.displayPause(), | 263 suite.environment.displayPause(), |
250 cancelableNext(stdinLines) | 264 cancelableNext(stdinLines) |
251 ]).first; | 265 ]).first; |
252 } finally { | 266 } finally { |
253 _reporter.resume(); | 267 _reporter.resume(); |
254 } | 268 } |
255 } | 269 } |
256 } | 270 } |
OLD | NEW |