Chromium Code Reviews| Index: bin/unittest.dart |
| diff --git a/bin/unittest.dart b/bin/unittest.dart |
| index 0189c8f1c4b9233f6d8c0ed6ee92c86d4f20c4f2..38d4770958c916716075bdb361b63ddb0893b194 100644 |
| --- a/bin/unittest.dart |
| +++ b/bin/unittest.dart |
| @@ -26,6 +26,10 @@ void main(List<String> args) { |
| _parser.addFlag("help", abbr: "h", negatable: false, |
| help: "Shows this usage information."); |
| _parser.addOption("package-root", hide: true); |
| + _parser.addOption("name", |
| + abbr: 'n', |
| + help: 'A substring of the name of the test to run.\n' |
| + 'Regular expression syntax is supported.'); |
|
kevmoo
2015/03/28 22:02:26
In theory I like regex support, but since we allow
nweiz
2015/03/30 19:45:41
I personally hate it when I have to switch up my c
kevmoo
2015/03/30 19:51:49
I'm fine if plain text is opt in. But we should ab
nweiz
2015/03/30 20:08:09
Done.
|
| _parser.addOption("platform", |
| abbr: 'p', |
| help: 'The platform(s) on which to run the tests.', |
| @@ -72,6 +76,22 @@ void main(List<String> args) { |
| throw new LoadException(path, 'Does not exist.'); |
| })); |
| }).then((suites) { |
| + suites = flatten(suites); |
| + |
| + if (options["name"] != null) { |
| + var expression = new RegExp(options["name"]); |
| + suites = suites.map((suite) { |
| + return suite.change( |
| + tests: suite.tests.where((test) => expression.hasMatch(test.name))); |
| + }).toList(); |
| + |
| + if (suites.every((suite) => suite.tests.isEmpty)) { |
| + stderr.writeln('No tests match "${options["name"]}".'); |
| + exitCode = exit_codes.data; |
| + return null; |
| + } |
| + } |
| + |
| var reporter = new CompactReporter(flatten(suites), color: color); |
| return reporter.run().then((success) { |
| exitCode = success ? 0 : 1; |