Merge pull request #3942 from hs0210/work

Add unit test for func in filter.go
This commit is contained in:
Derek McGowan 2020-02-18 12:05:22 -08:00 committed by GitHub
commit 986f294187
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,3 +317,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)
}
}
}