Index: lib/src/runner/parse_metadata.dart |
diff --git a/lib/src/runner/parse_metadata.dart b/lib/src/runner/parse_metadata.dart |
index fb84f4aab9ffe9ccc7302681cc62f4125c055a5a..f5c4d301340a9bb4591f89782193bc1d71ab8811 100644 |
--- a/lib/src/runner/parse_metadata.dart |
+++ b/lib/src/runner/parse_metadata.dart |
@@ -55,6 +55,7 @@ class _Parser { |
var testOn; |
var skip; |
var onPlatform; |
+ var tags; |
for (var annotation in _annotations) { |
var pair = _resolveConstructor( |
@@ -74,6 +75,9 @@ class _Parser { |
} else if (name == 'OnPlatform') { |
_assertSingle(onPlatform, 'OnPlatform', annotation); |
onPlatform = _parseOnPlatform(annotation, constructorName); |
+ } else if (name == 'Tags') { |
+ _assertSingle(tags, 'Tags', annotation); |
+ tags = _parseTags(annotation, constructorName); |
} |
} |
@@ -82,7 +86,8 @@ class _Parser { |
timeout: timeout, |
skip: skip != null, |
skipReason: skip is String ? skip : null, |
- onPlatform: onPlatform); |
+ onPlatform: onPlatform, |
+ tags: tags); |
} |
/// Parses a `@TestOn` annotation. |
@@ -163,6 +168,27 @@ class _Parser { |
return args.isEmpty ? true : _parseString(args.first).stringValue; |
} |
+ /// Parses a `@Tags` annotation. |
+ /// |
+ /// [annotation] is the annotation. [constructorName] is the name of the named |
+ /// constructor for the annotation, if any. |
+ Set<String> _parseTags(Annotation annotation, String constructorName) { |
+ _assertConstructorName(constructorName, 'Tags', annotation); |
+ _assertArguments(annotation.arguments, 'Tags', annotation, positional: 1); |
+ var arg = annotation.arguments.arguments.first; |
+ if (arg is ListLiteral) { |
+ var tagExpressions = _parseList(arg); |
+ return new Set<String>.from( |
+ tagExpressions.map((tagExpr) => _parseString(tagExpr).stringValue)); |
+ } else if (arg is StringLiteral) { |
+ return new Set<String>.from([_parseString(arg).stringValue]); |
+ } else { |
+ throw new SourceSpanFormatException( |
+ 'Only String or List literal allowed as @Tags argument', |
+ _spanFor(arg)); |
+ } |
+ } |
+ |
/// Parses an `@OnPlatform` annotation. |
/// |
/// [annotation] is the annotation. [constructorName] is the name of the named |