Skip to content

Commit d0da2c8

Browse files
committed
RHINENG-21424: update test for null filter operator
1 parent 923ead3 commit d0da2c8

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

manager/controllers/filter_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ var testFilters = []string{
1212
"eq:abc",
1313
"in:a,b,c",
1414
"gt:13",
15+
"gte:13",
1516
"lt:12",
17+
"lte:12",
1618
"between:12,13",
19+
"null:",
20+
"notnull:",
1721
}
1822

1923
func dummyParser(v string) (interface{}, error) {
@@ -22,15 +26,19 @@ func dummyParser(v string) (interface{}, error) {
2226

2327
func TestFilterParse(t *testing.T) {
2428
operators := []string{
25-
"eq", "in", "gt", "lt", "between",
29+
"eq", "in", "gt", "gte", "lt", "lte", "between", "null", "notnull",
2630
}
2731

2832
values := [][]string{
2933
{"abc"},
3034
{"a", "b", "c"},
3135
{"13"},
36+
{"13"},
37+
{"12"},
3238
{"12"},
3339
{"12", "13"},
40+
{""},
41+
{""},
3442
}
3543

3644
for i, f := range testFilters {
@@ -45,8 +53,12 @@ func TestFilterToSql(t *testing.T) {
4553
"test = ? ",
4654
"test IN (?) ",
4755
"test > ? ",
56+
"test >= ? ",
4857
"test < ? ",
58+
"test <= ? ",
4959
"test BETWEEN ? AND ? ",
60+
"test IS NULL ",
61+
"test IS NOT NULL ",
5062
}
5163

5264
for i, f := range testFilters {
@@ -64,8 +76,12 @@ func TestFilterToSqlAdvanced(t *testing.T) {
6476
"(NOT test) = ? ",
6577
"(NOT test) IN (?) ",
6678
"(NOT test) > ? ",
79+
"(NOT test) >= ? ",
6780
"(NOT test) < ? ",
81+
"(NOT test) <= ? ",
6882
"(NOT test) BETWEEN ? AND ? ",
83+
"(NOT test) IS NULL ",
84+
"(NOT test) IS NOT NULL ",
6985
}
7086

7187
for i, f := range testFilters {

0 commit comments

Comments
 (0)