forked from cucumber/godog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tag_filter_test.go
29 lines (24 loc) · 964 Bytes
/
tag_filter_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package godog
import (
"testing"
)
func assertNotMatchesTagFilter(tags []string, filter string, t *testing.T) {
if matchesTags(filter, tags) {
t.Errorf(`expected tags: %v not to match tag filter "%s", but it did`, tags, filter)
}
}
func assertMatchesTagFilter(tags []string, filter string, t *testing.T) {
if !matchesTags(filter, tags) {
t.Errorf(`expected tags: %v to match tag filter "%s", but it did not`, tags, filter)
}
}
func TestTagFilter(t *testing.T) {
assertMatchesTagFilter([]string{"wip"}, "@wip", t)
assertMatchesTagFilter([]string{}, "~@wip", t)
assertMatchesTagFilter([]string{"one", "two"}, "@two,@three", t)
assertMatchesTagFilter([]string{"one", "two"}, "@one&&@two", t)
assertMatchesTagFilter([]string{"one", "two"}, "one && two", t)
assertNotMatchesTagFilter([]string{}, "@wip", t)
assertNotMatchesTagFilter([]string{"one", "two"}, "@one&&~@two", t)
assertNotMatchesTagFilter([]string{"one", "two"}, "@one && ~@two", t)
}