Skip to content

Commit 4b2746a

Browse files
committed
add json tests
1 parent 064b824 commit 4b2746a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

enginetest/queries/json_scripts.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,4 +1004,25 @@ var JsonScripts = []ScriptTest{
10041004
},
10051005
},
10061006
},
1007+
{
1008+
Name: "Comparisons with JSON values containing non-JSON types",
1009+
SetUpScript: []string{
1010+
"CREATE TABLE test (j json);",
1011+
"insert into test VALUES ('{ \"key\": 1.0 }');",
1012+
},
1013+
Assertions: []ScriptTestAssertion{
1014+
{
1015+
Query: "select * from test where JSON_OBJECT(\"key\", 0.0) < test.j;",
1016+
Expected: []sql.Row{{types.MustJSON("{\"key\": 1.0}")}},
1017+
},
1018+
{
1019+
Query: `select * from test where JSON_OBJECT("key", 1.0) = test.j;`,
1020+
Expected: []sql.Row{{types.MustJSON("{\"key\": 1.0}")}},
1021+
},
1022+
{
1023+
Query: `select * from test where JSON_OBJECT("key", 2.0) > test.j;`,
1024+
Expected: []sql.Row{{types.MustJSON("{\"key\": 1.0}")}},
1025+
},
1026+
},
1027+
},
10071028
}

0 commit comments

Comments
 (0)