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

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

Issue 1405633004: feature: tag tests; choose tags on command line Base URL: git@github.com:yjbanov/test.git@tags
Patch Set: Created 5 years, 2 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 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
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 if (_config.pattern == null) return suite; 161 return suite.filter((test) =>
162 return suite.filter((test) => test.name.contains(_config.pattern)); 162 (_config.pattern == null || test.name.contains(_config.pattern)) &&
163 (_config.tags.isEmpty || intersect(_config.tags, test.metadata.tags) ));
163 }); 164 });
164 }); 165 });
165 } 166 }
166 167
167 /// Loads each suite in [suites] in order, pausing after load for platforms 168 /// Loads each suite in [suites] in order, pausing after load for platforms
168 /// that support debugging. 169 /// that support debugging.
169 Future<bool> _loadThenPause(Stream<LoadSuite> suites) async { 170 Future<bool> _loadThenPause(Stream<LoadSuite> suites) async {
170 if (_config.platforms.contains(TestPlatform.vm)) { 171 if (_config.platforms.contains(TestPlatform.vm)) {
171 warn("Debugging is currently unsupported on the Dart VM.", 172 warn("Debugging is currently unsupported on the Dart VM.",
172 color: _config.color); 173 color: _config.color);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 247
247 await inCompletionOrder([ 248 await inCompletionOrder([
248 suite.environment.displayPause(), 249 suite.environment.displayPause(),
249 cancelableNext(stdinLines) 250 cancelableNext(stdinLines)
250 ]).first; 251 ]).first;
251 } finally { 252 } finally {
252 _reporter.resume(); 253 _reporter.resume();
253 } 254 }
254 } 255 }
255 } 256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698