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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/runner.dart
diff --git a/lib/src/runner.dart b/lib/src/runner.dart
index 1eb6f2c78dc3ed248215f0738d75778a341f87d1..96d41b89977dde7c3fe4baa7f847352e68ce8d61 100644
--- a/lib/src/runner.dart
+++ b/lib/src/runner.dart
@@ -126,16 +126,12 @@ class Runner {
if (_closed) return false;
if (_engine.passed.length == 0 && _engine.failed.length == 0 &&
- _engine.skipped.length == 0 && _config.pattern != null) {
- var message = 'No tests match ';
-
- if (_config.pattern is RegExp) {
- var pattern = (_config.pattern as RegExp).pattern;
- message += 'regular expression "$pattern".';
- } else {
- message += '"${_config.pattern}".';
- }
- throw new ApplicationException(message);
+ _engine.skipped.length == 0 && _config.patterns.isNotEmpty) {
+ throw new ApplicationException('No tests match ' +
+ 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.
+ pattern is RegExp
+ ? 'regular expression "${pattern.pattern}"'
+ : '"$pattern"')) + '.');
}
// Explicitly check "== true" here because [Engine.run] can return `null`
@@ -232,7 +228,7 @@ class Runner {
/// Return a stream of [LoadSuite]s in [_config.paths].
///
- /// Only tests that match [_config.pattern] will be included in the
+ /// Only tests that match [_config.patterns] will be included in the
/// suites once they're loaded.
Stream<LoadSuite> _loadSuites() {
return mergeStreams(_config.paths.map((path) {
@@ -248,8 +244,8 @@ class Runner {
_warnForUnknownTags(suite);
return suite.filter((test) {
- // Skip any tests that don't match the given pattern.
- if (_config.pattern != null && !test.name.contains(_config.pattern)) {
+ // Skip any tests that don't match all the given patterns.
+ if (!_config.patterns.every(test.name.contains)) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698