Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/antlr4/com/pdsl/gherkin/filter/GherkinTags.g4
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fragment T : 'T' | 't';

fragment R : 'R' | 'r';

TAG :'@' ~[@ )]+ ;
TAG :'@' ~[@ ()]+ ('(' ~[)]* ')')? ;
WS : [ \t]+ -> skip;
AND : A N D ;
OR : O R;
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/com/pdsl/unit/GherkinTagFiltererTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ public void filterTagWithSpecialCharacterPositive_keepPickle() {
assertThat(filter.tagExpressionMatchesPickle(tags, "@!@#$")).isTrue();
}

@Test
public void filterTagWithParenthesizedUuidValue_keepPickle() {
Set<String> uuidTags = Set.of("@id(\"550e8400-e29b-41d4-a716-446655440000\")");
assertThat(filter.tagExpressionMatchesPickle(uuidTags,
"@id(\"550e8400-e29b-41d4-a716-446655440000\")")).isTrue();
}

@Test
public void filterTagWithParenthesizedValue_andExpression_keepPickle() {
Set<String> uuidTags = Set.of("@id(\"550e8400-e29b-41d4-a716-446655440000\")", "@tagB");
assertThat(filter.tagExpressionMatchesPickle(uuidTags,
"@id(\"550e8400-e29b-41d4-a716-446655440000\") and @tagB")).isTrue();
}

@Test
public void filterTagWithParenthesizedValue_mismatchedUuid_removePickle() {
Set<String> uuidTags = Set.of("@id(\"550e8400-e29b-41d4-a716-446655440000\")");
assertThat(filter.tagExpressionMatchesPickle(uuidTags,
"@id(\"00000000-0000-0000-0000-000000000000\")")).isFalse();
}

@Test
public void filterTagNotExpression_keepPickle() {
assertThat(filter.tagExpressionMatchesPickle(tags, "not @tagMissing")).isTrue();
Expand Down