Add unit test for func in filter.go

Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
This commit is contained in:
Hu Shuai 2020-01-08 09:47:26 +08:00
parent 0d276ece0e
commit 7b52bc506c

View File

@ -307,3 +307,20 @@ func TestFilters(t *testing.T) {
})
}
}
func TestOperatorStrings(t *testing.T) {
for _, testcase := range []struct {
op operator
expected string
}{
{operatorPresent, "?"},
{operatorEqual, "=="},
{operatorNotEqual, "!="},
{operatorMatches, "~="},
{10, "unknown"},
} {
if !reflect.DeepEqual(testcase.op.String(), testcase.expected) {
t.Fatalf("return value unexpected: %v != %v", testcase.op.String(), testcase.expected)
}
}
}