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

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: address review comments Created 5 years, 1 month 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 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
167 List unrecognizedTags = test.metadata.tags.difference(_config.tags);
168 if (unrecognizedTags.isNotEmpty) {
169 var yellow = _config.color ? '\u001b[33m' : '';
170 stderr.writeln("\n${yellow}WARNING: unrecognized tags ${unrecognized Tags} in test '${test.name}'");
171 }
172
173 return matchesNamePattern && matchesTags;
174 });
164 }); 175 });
165 }); 176 });
166 } 177 }
167 178
168 /// Loads each suite in [suites] in order, pausing after load for platforms 179 /// Loads each suite in [suites] in order, pausing after load for platforms
169 /// that support debugging. 180 /// that support debugging.
170 Future<bool> _loadThenPause(Stream<LoadSuite> suites) async { 181 Future<bool> _loadThenPause(Stream<LoadSuite> suites) async {
171 if (_config.platforms.contains(TestPlatform.vm)) { 182 if (_config.platforms.contains(TestPlatform.vm)) {
172 warn("Debugging is currently unsupported on the Dart VM.", 183 warn("Debugging is currently unsupported on the Dart VM.",
173 color: _config.color); 184 color: _config.color);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 258
248 await inCompletionOrder([ 259 await inCompletionOrder([
249 suite.environment.displayPause(), 260 suite.environment.displayPause(),
250 cancelableNext(stdinLines) 261 cancelableNext(stdinLines)
251 ]).first; 262 ]).first;
252 } finally { 263 } finally {
253 _reporter.resume(); 264 _reporter.resume();
254 } 265 }
255 } 266 }
256 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698