Skip to content

Commit 986f294

Browse files
authored
Merge pull request containerd#3942 from hs0210/work
Add unit test for func in filter.go
2 parents 724d0eb + 7b52bc5 commit 986f294

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

filters/filter_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,20 @@ func TestFilters(t *testing.T) {
317317
})
318318
}
319319
}
320+
321+
func TestOperatorStrings(t *testing.T) {
322+
for _, testcase := range []struct {
323+
op operator
324+
expected string
325+
}{
326+
{operatorPresent, "?"},
327+
{operatorEqual, "=="},
328+
{operatorNotEqual, "!="},
329+
{operatorMatches, "~="},
330+
{10, "unknown"},
331+
} {
332+
if !reflect.DeepEqual(testcase.op.String(), testcase.expected) {
333+
t.Fatalf("return value unexpected: %v != %v", testcase.op.String(), testcase.expected)
334+
}
335+
}
336+
}

0 commit comments

Comments
 (0)