github.com/data-DOG/godog@v0.7.9/tag_filter_test.go (about)

     1  package godog
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func assertNotMatchesTagFilter(tags []string, filter string, t *testing.T) {
     8  	if matchesTags(filter, tags) {
     9  		t.Errorf(`expected tags: %v not to match tag filter "%s", but it did`, tags, filter)
    10  	}
    11  }
    12  
    13  func assertMatchesTagFilter(tags []string, filter string, t *testing.T) {
    14  	if !matchesTags(filter, tags) {
    15  		t.Errorf(`expected tags: %v to match tag filter "%s", but it did not`, tags, filter)
    16  	}
    17  }
    18  
    19  func TestTagFilter(t *testing.T) {
    20  	assertMatchesTagFilter([]string{"wip"}, "@wip", t)
    21  	assertMatchesTagFilter([]string{}, "~@wip", t)
    22  	assertMatchesTagFilter([]string{"one", "two"}, "@two,@three", t)
    23  	assertMatchesTagFilter([]string{"one", "two"}, "@one&&@two", t)
    24  	assertMatchesTagFilter([]string{"one", "two"}, "one && two", t)
    25  
    26  	assertNotMatchesTagFilter([]string{}, "@wip", t)
    27  	assertNotMatchesTagFilter([]string{"one", "two"}, "@one&&~@two", t)
    28  	assertNotMatchesTagFilter([]string{"one", "two"}, "@one && ~@two", t)
    29  }