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()", () { |