Fix a JSON1 test case so that it works on builds that omit virtual tables.

FossilOrigin-Name: a4444c0f662058bdd5267e616c31cef828bc1fc5
This commit is contained in:
drh 2015-09-24 11:06:26 +00:00
parent 8cb15cc5ae
commit b7601461e0
3 changed files with 33 additions and 31 deletions

View File

@ -1,5 +1,5 @@
C Another\s(smaller)\sperformance\soptimization\sfor\sthe\sJSON\sparser. C Fix\sa\sJSON1\stest\scase\sso\sthat\sit\sworks\son\sbuilds\sthat\somit\svirtual\stables.
D 2015-09-24T01:40:45.848 D 2015-09-24T11:06:26.506
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in e1afa6fb2de2bddd50e0ddae8166c2ee9d69b301 F Makefile.in e1afa6fb2de2bddd50e0ddae8166c2ee9d69b301
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -816,7 +816,7 @@ F test/journal3.test ff8af941f9e06161d3db1b46bb9f965ff0e7f307
F test/jrnlmode.test 7864d59cf7f6e552b9b99ba0f38acd167edc10fa F test/jrnlmode.test 7864d59cf7f6e552b9b99ba0f38acd167edc10fa
F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d F test/jrnlmode2.test 81610545a4e6ed239ea8fa661891893385e23a1d
F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa F test/jrnlmode3.test 556b447a05be0e0963f4311e95ab1632b11c9eaa
F test/json101.test 07f0d847d943bf5ad6e8fb60699a7f4c57317321 F test/json101.test e8b50fbcdbf283cfafbc42632bf2c7dfa4541c46
F test/json102.test 796b1c59894c6e0f38fc1a3acb0e690573b952a3 F test/json102.test 796b1c59894c6e0f38fc1a3acb0e690573b952a3
F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff
F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63 F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63
@ -1388,7 +1388,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 7dd4b07a42eb84589d34430b9d7bfa88fbd743eb P c43daa8c78df99f62dd4d3c83708a3a8eff92496
R 35931ccc4bad18cd2e2cb0703934d351 R 58ea6ba9d04066436f9d8f6b2170ec8e
U drh U drh
Z 66f4794fa30512464c1e57a2a59bf55d Z 759cfd5c38ee08c1a1303bbe88ed012d

View File

@ -1 +1 @@
c43daa8c78df99f62dd4d3c83708a3a8eff92496 a4444c0f662058bdd5267e616c31cef828bc1fc5

View File

@ -16,28 +16,28 @@ set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
load_static_extension db json load_static_extension db json
do_execsql_test json1-1.1.00 { do_execsql_test json101-1.1.00 {
SELECT json_array(1,2.5,null,'hello'); SELECT json_array(1,2.5,null,'hello');
} {[1,2.5,null,"hello"]} } {[1,2.5,null,"hello"]}
do_execsql_test json1-1.1.01 { do_execsql_test json101-1.1.01 {
SELECT json_array(1,'{"abc":2.5,"def":null,"ghi":hello}',99); SELECT json_array(1,'{"abc":2.5,"def":null,"ghi":hello}',99);
-- the second term goes in as a string: -- the second term goes in as a string:
} {[1,"{\\"abc\\":2.5,\\"def\\":null,\\"ghi\\":hello}",99]} } {[1,"{\\"abc\\":2.5,\\"def\\":null,\\"ghi\\":hello}",99]}
do_execsql_test json1-1.1.02 { do_execsql_test json101-1.1.02 {
SELECT json_array(1,json('{"abc":2.5,"def":null,"ghi":"hello"}'),99); SELECT json_array(1,json('{"abc":2.5,"def":null,"ghi":"hello"}'),99);
-- the second term goes in as JSON -- the second term goes in as JSON
} {[1,{"abc":2.5,"def":null,"ghi":"hello"},99]} } {[1,{"abc":2.5,"def":null,"ghi":"hello"},99]}
do_execsql_test json1-1.1.03 { do_execsql_test json101-1.1.03 {
SELECT json_array(1,json_object('abc',2.5,'def',null,'ghi','hello'),99); SELECT json_array(1,json_object('abc',2.5,'def',null,'ghi','hello'),99);
-- the second term goes in as JSON -- the second term goes in as JSON
} {[1,{"abc":2.5,"def":null,"ghi":"hello"},99]} } {[1,{"abc":2.5,"def":null,"ghi":"hello"},99]}
do_execsql_test json1-1.2 { do_execsql_test json101-1.2 {
SELECT hex(json_array('String "\ Test')); SELECT hex(json_array('String "\ Test'));
} {5B22537472696E67205C225C5C2054657374225D} } {5B22537472696E67205C225C5C2054657374225D}
do_catchsql_test json1-1.3 { do_catchsql_test json101-1.3 {
SELECT json_array(1,printf('%.1000c','x'),x'abcd',3); SELECT json_array(1,printf('%.1000c','x'),x'abcd',3);
} {1 {JSON cannot hold BLOB values}} } {1 {JSON cannot hold BLOB values}}
do_execsql_test json1-1.4 { do_execsql_test json101-1.4 {
SELECT json_array(-9223372036854775808,9223372036854775807,0,1,-1, SELECT json_array(-9223372036854775808,9223372036854775807,0,1,-1,
0.0, 1.0, -1.0, -1e99, +2e100, 0.0, 1.0, -1.0, -1e99, +2e100,
'one','two','three', 'one','two','three',
@ -49,39 +49,41 @@ do_execsql_test json1-1.4 {
99); 99);
} {[-9223372036854775808,9223372036854775807,0,1,-1,0.0,1.0,-1.0,-1.0e+99,2.0e+100,"one","two","three",4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,null,21,22,23,24,25,26,27,28,29,30,31,"abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ",99]} } {[-9223372036854775808,9223372036854775807,0,1,-1,0.0,1.0,-1.0,-1.0e+99,2.0e+100,"one","two","three",4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,null,21,22,23,24,25,26,27,28,29,30,31,"abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ",99]}
do_execsql_test json1-2.1 { do_execsql_test json101-2.1 {
SELECT json_object('a',1,'b',2.5,'c',null,'d','String Test'); SELECT json_object('a',1,'b',2.5,'c',null,'d','String Test');
} {{{"a":1,"b":2.5,"c":null,"d":"String Test"}}} } {{{"a":1,"b":2.5,"c":null,"d":"String Test"}}}
do_catchsql_test json1-2.2 { do_catchsql_test json101-2.2 {
SELECT json_object('a',printf('%.1000c','x'),2,2.5); SELECT json_object('a',printf('%.1000c','x'),2,2.5);
} {1 {json_object() labels must be TEXT}} } {1 {json_object() labels must be TEXT}}
do_catchsql_test json1-2.3 { do_catchsql_test json101-2.3 {
SELECT json_object('a',1,'b'); SELECT json_object('a',1,'b');
} {1 {json_object() requires an even number of arguments}} } {1 {json_object() requires an even number of arguments}}
do_catchsql_test json1-2.4 { do_catchsql_test json101-2.4 {
SELECT json_object('a',printf('%.1000c','x'),'b',x'abcd'); SELECT json_object('a',printf('%.1000c','x'),'b',x'abcd');
} {1 {JSON cannot hold BLOB values}} } {1 {JSON cannot hold BLOB values}}
do_execsql_test json1-3.1 { do_execsql_test json101-3.1 {
SELECT json_replace('{"a":1,"b":2}','$.a','[3,4,5]'); SELECT json_replace('{"a":1,"b":2}','$.a','[3,4,5]');
} {{{"a":"[3,4,5]","b":2}}} } {{{"a":"[3,4,5]","b":2}}}
do_execsql_test json1-3.2 { do_execsql_test json101-3.2 {
SELECT json_replace('{"a":1,"b":2}','$.a',json('[3,4,5]')); SELECT json_replace('{"a":1,"b":2}','$.a',json('[3,4,5]'));
} {{{"a":[3,4,5],"b":2}}} } {{{"a":[3,4,5],"b":2}}}
do_execsql_test json1-3.3 { do_execsql_test json101-3.3 {
SELECT json_type(json_set('{"a":1,"b":2}','$.b','{"x":3,"y":4}'),'$.b'); SELECT json_type(json_set('{"a":1,"b":2}','$.b','{"x":3,"y":4}'),'$.b');
} {text} } {text}
do_execsql_test json1-3.4 { do_execsql_test json101-3.4 {
SELECT json_type(json_set('{"a":1,"b":2}','$.b',json('{"x":3,"y":4}')),'$.b'); SELECT json_type(json_set('{"a":1,"b":2}','$.b',json('{"x":3,"y":4}')),'$.b');
} {object} } {object}
do_execsql_test json1-3.5 { ifcapable vtab {
do_execsql_test json101-3.5 {
SELECT fullkey, atom, '|' FROM json_tree(json_set('{}','$.x',123,'$.x',456)); SELECT fullkey, atom, '|' FROM json_tree(json_set('{}','$.x',123,'$.x',456));
} {{$} {} | {$.x} 456 |} } {{$} {} | {$.x} 456 |}
}
# Per rfc7159, any JSON value is allowed at the top level, and whitespace # Per rfc7159, any JSON value is allowed at the top level, and whitespace
# is permitting before and/or after that value. # is permitting before and/or after that value.
# #
do_execsql_test json1-4.1 { do_execsql_test json101-4.1 {
CREATE TABLE j1(x); CREATE TABLE j1(x);
INSERT INTO j1(x) INSERT INTO j1(x)
VALUES('true'),('false'),('null'),('123'),('-234'),('34.5e+6'), VALUES('true'),('false'),('null'),('123'),('-234'),('34.5e+6'),
@ -90,32 +92,32 @@ do_execsql_test json1-4.1 {
('{"a":true,"b":{"c":false}}'); ('{"a":true,"b":{"c":false}}');
SELECT * FROM j1 WHERE NOT json_valid(x); SELECT * FROM j1 WHERE NOT json_valid(x);
} {} } {}
do_execsql_test json1-4.2 { do_execsql_test json101-4.2 {
SELECT * FROM j1 WHERE NOT json_valid(char(0x20,0x09,0x0a,0x0d)||x); SELECT * FROM j1 WHERE NOT json_valid(char(0x20,0x09,0x0a,0x0d)||x);
} {} } {}
do_execsql_test json1-4.3 { do_execsql_test json101-4.3 {
SELECT * FROM j1 WHERE NOT json_valid(x||char(0x20,0x09,0x0a,0x0d)); SELECT * FROM j1 WHERE NOT json_valid(x||char(0x20,0x09,0x0a,0x0d));
} {} } {}
# But an empty string, or a string of pure whitespace is not valid JSON. # But an empty string, or a string of pure whitespace is not valid JSON.
# #
do_execsql_test json1-4.4 { do_execsql_test json101-4.4 {
SELECT json_valid(''), json_valid(char(0x20,0x09,0x0a,0x0d)); SELECT json_valid(''), json_valid(char(0x20,0x09,0x0a,0x0d));
} {0 0} } {0 0}
# json_remove() and similar functions with no edit operations return their # json_remove() and similar functions with no edit operations return their
# input unchanged. # input unchanged.
# #
do_execsql_test json1-4.5 { do_execsql_test json101-4.5 {
SELECT x FROM j1 WHERE json_remove(x)<>x; SELECT x FROM j1 WHERE json_remove(x)<>x;
} {} } {}
do_execsql_test json1-4.6 { do_execsql_test json101-4.6 {
SELECT x FROM j1 WHERE json_replace(x)<>x; SELECT x FROM j1 WHERE json_replace(x)<>x;
} {} } {}
do_execsql_test json1-4.7 { do_execsql_test json101-4.7 {
SELECT x FROM j1 WHERE json_set(x)<>x; SELECT x FROM j1 WHERE json_set(x)<>x;
} {} } {}
do_execsql_test json1-4.8 { do_execsql_test json101-4.8 {
SELECT x FROM j1 WHERE json_insert(x)<>x; SELECT x FROM j1 WHERE json_insert(x)<>x;
} {} } {}