Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: lib/src/runner.dart

Issue 1802133002: Add names and plain_names fields. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 var results = await Future.wait([ 119 var results = await Future.wait([
120 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), 120 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()),
121 _engine.run() 121 _engine.run()
122 ], eagerError: true); 122 ], eagerError: true);
123 success = results.last; 123 success = results.last;
124 } 124 }
125 125
126 if (_closed) return false; 126 if (_closed) return false;
127 127
128 if (_engine.passed.length == 0 && _engine.failed.length == 0 && 128 if (_engine.passed.length == 0 && _engine.failed.length == 0 &&
129 _engine.skipped.length == 0 && _config.pattern != null) { 129 _engine.skipped.length == 0 && _config.patterns.isNotEmpty) {
130 var message = 'No tests match '; 130 throw new ApplicationException('No tests match ' +
131 131 toSentence(_config.patterns.map((pattern) =>
kevmoo 2016/03/14 23:08:47 I'd create a variable for the toSentence output an
nweiz 2016/03/14 23:20:24 Done.
132 if (_config.pattern is RegExp) { 132 pattern is RegExp
133 var pattern = (_config.pattern as RegExp).pattern; 133 ? 'regular expression "${pattern.pattern}"'
134 message += 'regular expression "$pattern".'; 134 : '"$pattern"')) + '.');
135 } else {
136 message += '"${_config.pattern}".';
137 }
138 throw new ApplicationException(message);
139 } 135 }
140 136
141 // Explicitly check "== true" here because [Engine.run] can return `null` 137 // Explicitly check "== true" here because [Engine.run] can return `null`
142 // if the engine was closed prematurely. 138 // if the engine was closed prematurely.
143 return success == true; 139 return success == true;
144 } 140 }
145 141
146 /// Emits a warning if the user is trying to run on a platform that's 142 /// Emits a warning if the user is trying to run on a platform that's
147 /// unsupported for the entire package. 143 /// unsupported for the entire package.
148 void _warnForUnsupportedPlatforms() { 144 void _warnForUnsupportedPlatforms() {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 await Future.wait([ 221 await Future.wait([
226 _loader.closeEphemeral(), 222 _loader.closeEphemeral(),
227 _engine.close() 223 _engine.close()
228 ]); 224 ]);
229 if (timer != null) timer.cancel(); 225 if (timer != null) timer.cancel();
230 await _loader.close(); 226 await _loader.close();
231 }); 227 });
232 228
233 /// Return a stream of [LoadSuite]s in [_config.paths]. 229 /// Return a stream of [LoadSuite]s in [_config.paths].
234 /// 230 ///
235 /// Only tests that match [_config.pattern] will be included in the 231 /// Only tests that match [_config.patterns] will be included in the
236 /// suites once they're loaded. 232 /// suites once they're loaded.
237 Stream<LoadSuite> _loadSuites() { 233 Stream<LoadSuite> _loadSuites() {
238 return mergeStreams(_config.paths.map((path) { 234 return mergeStreams(_config.paths.map((path) {
239 if (new Directory(path).existsSync()) return _loader.loadDir(path); 235 if (new Directory(path).existsSync()) return _loader.loadDir(path);
240 if (new File(path).existsSync()) return _loader.loadFile(path); 236 if (new File(path).existsSync()) return _loader.loadFile(path);
241 237
242 return new Stream.fromIterable([ 238 return new Stream.fromIterable([
243 new LoadSuite.forLoadException( 239 new LoadSuite.forLoadException(
244 new LoadException(path, 'Does not exist.')) 240 new LoadException(path, 'Does not exist.'))
245 ]); 241 ]);
246 })).map((loadSuite) { 242 })).map((loadSuite) {
247 return loadSuite.changeSuite((suite) { 243 return loadSuite.changeSuite((suite) {
248 _warnForUnknownTags(suite); 244 _warnForUnknownTags(suite);
249 245
250 return suite.filter((test) { 246 return suite.filter((test) {
251 // Skip any tests that don't match the given pattern. 247 // Skip any tests that don't match all the given patterns.
252 if (_config.pattern != null && !test.name.contains(_config.pattern)) { 248 if (!_config.patterns.every(test.name.contains)) {
253 return false; 249 return false;
254 } 250 }
255 251
256 // If the user provided tags, skip tests that don't match all of them. 252 // If the user provided tags, skip tests that don't match all of them.
257 if (!_config.includeTags.evaluate(test.metadata.tags)) return false; 253 if (!_config.includeTags.evaluate(test.metadata.tags)) return false;
258 254
259 // Skip tests that do match any tags the user wants to exclude. 255 // Skip tests that do match any tags the user wants to exclude.
260 if (_config.excludeTags.evaluate(test.metadata.tags)) return false; 256 if (_config.excludeTags.evaluate(test.metadata.tags)) return false;
261 257
262 return true; 258 return true;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 await _debugOperation.valueOrCancellation(); 349 await _debugOperation.valueOrCancellation();
354 }).listen(null); 350 }).listen(null);
355 351
356 var results = await Future.wait([ 352 var results = await Future.wait([
357 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), 353 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()),
358 _engine.run() 354 _engine.run()
359 ]); 355 ]);
360 return results.last; 356 return results.last;
361 } 357 }
362 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698