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

Unified Diff: test/backend/declarer_test.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, 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 side-by-side diff with in-line comments
Download patch
Index: test/backend/declarer_test.dart
diff --git a/test/backend/declarer_test.dart b/test/backend/declarer_test.dart
index 39fc3abc5cb21017f1aa2ecdcc07eaf84e500728..8671f575f5ab316461aafcea53b01ed618a726da 100644
--- a/test/backend/declarer_test.dart
+++ b/test/backend/declarer_test.dart
@@ -48,6 +48,27 @@ void main() {
expect(tests[1].name, equals("description 2"));
expect(tests[2].name, equals("description 3"));
});
+
+ test("declares a test with tags", () {
+ var tests = declare(() {
+ test("tags as String", () {}, tags: "a");
+ test("tags as List", () {}, tags: ["a", "b"]);
+ test("tags as null", () {}, tags: null);
+ });
+
+ expect(tests, hasLength(3));
+ expect(tests[0].metadata.tags, unorderedEquals(["a"]));
+ expect(tests[1].metadata.tags, unorderedEquals(["a", "b"]));
+ expect(tests[2].metadata.tags, isEmpty);
+ });
+
+ test("throws on invalid tags", () {
+ expect(() {
+ declare(() {
+ test("a", () {}, tags: 1);
+ });
+ }, throwsArgumentError);
+ });
});
group(".setUp()", () {
@@ -414,6 +435,32 @@ void main() {
return _runTest(entries.single.entries.single);
});
+
+ test("inherits group's tags", () {
+ var tests = declare(() {
+ group("outer", () {
+ group("inner", () {
+ test("with tags", () {}, tags: "d");
+ }, tags: ["b", "c"]);
+ }, tags: "a");
+ });
+
+ var outerGroup = tests.single;
+ var innerGroup = outerGroup.entries.single;
+ var testWithTags = innerGroup.entries.single;
+ expect(outerGroup.metadata.tags, unorderedEquals(["a"]));
+ expect(innerGroup.metadata.tags, unorderedEquals(["a", "b", "c"]));
+ expect(testWithTags.metadata.tags,
+ unorderedEquals(["a", "b", "c", "d"]));
+ });
+
+ test("throws on invalid tags", () {
+ expect(() {
+ declare(() {
+ group("a", () {}, tags: 1);
+ });
+ }, throwsArgumentError);
+ });
});
group(".tearDown()", () {

Powered by Google App Engine
This is Rietveld 408576698