diff options
author | drh <drh@noemail.net> | 2016-07-23 19:34:53 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2016-07-23 19:34:53 +0000 |
commit | 2ce26ff10a83039bd2c720f5e7cd585dfdaf3bee (patch) | |
tree | 01614428c91beca088d1a366c7478e67d2883e67 /test/json101.test | |
parent | eb09f6d788a76242003ff9dd42a7036c8656df0b (diff) | |
parent | 2ad96f5880fd77919571477dc0302cf763e527ff (diff) | |
download | sqlite-2ce26ff10a83039bd2c720f5e7cd585dfdaf3bee.tar.gz sqlite-2ce26ff10a83039bd2c720f5e7cd585dfdaf3bee.zip |
Add the json_quote() function to the JSON1 extension.
FossilOrigin-Name: 269892abf6e59c417729669cc764d1f237e093fd
Diffstat (limited to 'test/json101.test')
-rw-r--r-- | test/json101.test | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/json101.test b/test/json101.test index 9b780a379..3ee007c1c 100644 --- a/test/json101.test +++ b/test/json101.test @@ -356,5 +356,34 @@ do_execsql_test json-8.2 { SELECT a=json_extract(b,'$[0]') FROM t8; } {1} +# The json_quote() function transforms an SQL value into a JSON value. +# String values are quoted and interior quotes are escaped. NULL values +# are rendered as the unquoted string "null". +# +do_execsql_test json-9.1 { + SELECT json_quote('abc"xyz'); +} {{"abc\"xyz"}} +do_execsql_test json-9.2 { + SELECT json_quote(3.14159); +} {3.14159} +do_execsql_test json-9.3 { + SELECT json_quote(12345); +} {12345} +do_execsql_test json-9.4 { + SELECT json_quote(null); +} {"null"} +do_catchsql_test json-9.5 { + SELECT json_quote(x'30313233'); +} {1 {JSON cannot hold BLOB values}} +do_catchsql_test json-9.6 { + SELECT json_quote(123,456) +} {1 {wrong number of arguments to function json_quote()}} +do_catchsql_test json-9.7 { + SELECT json_quote() +} {1 {wrong number of arguments to function json_quote()}} + + + + finish_test |