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

Unified Diff: lib/src/backend/declarer.dart

Issue 1093633004: Add test- and group-level support for skipping tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 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
« no previous file with comments | « no previous file | lib/src/backend/metadata.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/declarer.dart
diff --git a/lib/src/backend/declarer.dart b/lib/src/backend/declarer.dart
index 01e814072b0021cda70bb44126a5f560c674130f..9912274c99eddef72c61061e5ca556958d8f8d04 100644
--- a/lib/src/backend/declarer.dart
+++ b/lib/src/backend/declarer.dart
@@ -38,14 +38,19 @@ class Declarer {
/// of 30 seconds. Timeout modifications take precedence in suite-group-test
/// order, so [timeout] will also modify any timeouts set on the group or
/// suite.
- void test(String description, body(), {String testOn, Timeout timeout}) {
+ ///
+ /// If [skip] is a String or `true`, the test is skipped. If it's a String, it
+ /// should explain why the test is skipped; this reason will be printed
+ /// instead of running the test.
+ void test(String description, body(), {String testOn, Timeout timeout,
+ skip}) {
// TODO(nweiz): Once tests have begun running, throw an error if [test] is
// called.
var prefix = _group.description;
if (prefix != null) description = "$prefix $description";
var metadata = _group.metadata.merge(
- new Metadata.parse(testOn: testOn, timeout: timeout));
+ new Metadata.parse(testOn: testOn, timeout: timeout, skip: skip));
var group = _group;
_tests.add(new LocalTest(description, metadata, () {
// TODO(nweiz): It might be useful to throw an error here if a test starts
@@ -68,11 +73,23 @@ class Declarer {
/// of 30 seconds. Timeout modifications take precedence in suite-group-test
/// order, so [timeout] will also modify any timeouts set on the group or
/// suite.
+ ///
+ /// If [skip] is a String or `true`, the group is skipped. If it's a String,
+ /// it should explain why the group is skipped; this reason will be printed
+ /// instead of running the group's tests.
void group(String description, void body(), {String testOn,
- Timeout timeout}) {
+ Timeout timeout, skip}) {
var oldGroup = _group;
- var metadata = new Metadata.parse(testOn: testOn, timeout: timeout);
+ var metadata = new Metadata.parse(
+ testOn: testOn, timeout: timeout, skip: skip);
+
+ // Don' load the tests for a skipped group.
+ if (metadata.skip) {
+ _tests.add(new LocalTest(description, metadata, () {}));
+ return;
+ }
+
_group = new Group(oldGroup, description, metadata);
try {
body();
« no previous file with comments | « no previous file | lib/src/backend/metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698