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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:async/async.dart'; | 8 import 'package:async/async.dart'; |
9 | 9 |
10 import 'backend/group.dart'; | 10 import 'backend/group.dart'; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 /// Return a stream of [LoadSuite]s in [_config.paths]. | 174 /// Return a stream of [LoadSuite]s in [_config.paths]. |
175 /// | 175 /// |
176 /// Only tests that match [_config.pattern] will be included in the | 176 /// Only tests that match [_config.pattern] will be included in the |
177 /// suites once they're loaded. | 177 /// suites once they're loaded. |
178 Stream<LoadSuite> _loadSuites() { | 178 Stream<LoadSuite> _loadSuites() { |
179 return mergeStreams(_config.paths.map((path) { | 179 return mergeStreams(_config.paths.map((path) { |
180 if (new Directory(path).existsSync()) return _loader.loadDir(path); | 180 if (new Directory(path).existsSync()) return _loader.loadDir(path); |
181 if (new File(path).existsSync()) return _loader.loadFile(path); | 181 if (new File(path).existsSync()) return _loader.loadFile(path); |
182 | 182 |
183 return new Stream.fromIterable([ | 183 return new Stream.fromIterable([ |
184 new LoadSuite("loading $path", () => | 184 new LoadSuite.forLoadException( |
185 throw new LoadException(path, 'Does not exist.')) | 185 new LoadException(path, 'Does not exist.')) |
186 ]); | 186 ]); |
187 })).map((loadSuite) { | 187 })).map((loadSuite) { |
188 return loadSuite.changeSuite((suite) { | 188 return loadSuite.changeSuite((suite) { |
189 _warnForUnknownTags(suite); | 189 _warnForUnknownTags(suite); |
190 | 190 |
191 return suite.filter((test) { | 191 return suite.filter((test) { |
192 // Skip any tests that don't match the given pattern. | 192 // Skip any tests that don't match the given pattern. |
193 if (_config.pattern != null && !test.name.contains(_config.pattern)) { | 193 if (_config.pattern != null && !test.name.contains(_config.pattern)) { |
194 return false; | 194 return false; |
195 } | 195 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 await _debugOperation.valueOrCancellation(); | 299 await _debugOperation.valueOrCancellation(); |
300 }).listen(null); | 300 }).listen(null); |
301 | 301 |
302 var results = await Future.wait([ | 302 var results = await Future.wait([ |
303 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), | 303 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), |
304 _engine.run() | 304 _engine.run() |
305 ]); | 305 ]); |
306 return results.last; | 306 return results.last; |
307 } | 307 } |
308 } | 308 } |
OLD | NEW |