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

Unified Diff: test/runner/tag_test.dart

Issue 1491383003: Disallow non-hyphenated-identifier tag names. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years 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 | « lib/src/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/runner/tag_test.dart
diff --git a/test/runner/tag_test.dart b/test/runner/tag_test.dart
index 6a2c297d8e30b8a95f498e860ada6d4a8d320f02..67e2c232fb4c5a9ab281401e765ef9cdc0769023 100644
--- a/test/runner/tag_test.dart
+++ b/test/runner/tag_test.dart
@@ -264,6 +264,61 @@ void main() {
test.shouldExit(0);
});
});
+
+ group("invalid tags", () {
+ test("are disallowed by test()", () {
+ d.file("test.dart", """
+ import 'package:test/test.dart';
+
+ void main() {
+ test("foo", () {}, tags: "a b");
+ }
+ """).create();
+
+ var test = runTest(["test.dart"]);
+ test.stdout.expect(consumeThrough(
+ ' Failed to load "test.dart": Invalid argument(s): Invalid tag "a '
+ 'b". Tags must be (optionally hyphenated) Dart identifiers.'));
+ test.shouldExit(1);
+ });
+
+ test("are disallowed by group()", () {
+ d.file("test.dart", """
+ import 'package:test/test.dart';
+
+ void main() {
+ group("group", () {
+ test("foo", () {});
+ }, tags: "a b");
+ }
+ """).create();
+
+ var test = runTest(["test.dart"]);
+ test.stdout.expect(consumeThrough(
+ ' Failed to load "test.dart": Invalid argument(s): Invalid tag "a '
+ 'b". Tags must be (optionally hyphenated) Dart identifiers.'));
+ test.shouldExit(1);
+ });
+
+ test("are disallowed by @Tags()", () {
+ d.file("test.dart", """
+ @Tags(const ["a b"])
+
+ import 'package:test/test.dart';
+
+ void main() {
+ test("foo", () {});
+ }
+ """).create();
+
+ var test = runTest(["test.dart"]);
+ test.stdout.expect(consumeThrough(lines(
+ ' Failed to load "test.dart":\n'
+ ' Error on line 1, column 22: Invalid tag name. Tags must be '
+ '(optionally hyphenated) Dart identifiers.')));
+ test.shouldExit(1);
+ });
+ });
}
/// Returns a [StreamMatcher] that asserts that a test emits warnings for [tags]
« no previous file with comments | « lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698