diff options
author | drh <> | 2024-03-06 20:38:52 +0000 |
---|---|---|
committer | drh <> | 2024-03-06 20:38:52 +0000 |
commit | 1b977e3ae83db9fdfe70e650ca3bc3d22703ead9 (patch) | |
tree | 374c330a6aba49fd05054b03c72bcb8df1945117 /test/json108.test | |
parent | 31c3ac9049a3e6c418ad3a1d7ce97c980968b9b9 (diff) | |
download | sqlite-1b977e3ae83db9fdfe70e650ca3bc3d22703ead9.tar.gz sqlite-1b977e3ae83db9fdfe70e650ca3bc3d22703ead9.zip |
Add test cases for json_pretty().
FossilOrigin-Name: 6448b90708eeedef03e82dcb10d2879e1bc859d422b450c5fc403ffbe0343bed
Diffstat (limited to 'test/json108.test')
-rw-r--r-- | test/json108.test | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/json108.test b/test/json108.test new file mode 100644 index 000000000..71f3814dc --- /dev/null +++ b/test/json108.test @@ -0,0 +1,45 @@ +# 2024-03-06 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# Invariant tests for JSON built around the randomjson extension +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix json108 + +# These tests require virtual table "json_tree" to run. +ifcapable !vtab { finish_test ; return } + +load_static_extension db randomjson +db eval { + CREATE TEMP TABLE t1(j0,j5); + WITH RECURSIVE c(n) AS (VALUES(0) UNION ALL SELECT n+1 FROM c WHERE n<9) + INSERT INTO t1 SELECT random_json(n), random_json5(n) FROM c; +} + +do_execsql_test 1.1 { + SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,NULL)); +} 10 +do_execsql_test 1.2 { + SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,NULL)); +} 10 +do_execsql_test 1.3 { + SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,'')); +} 10 +do_execsql_test 1.4 { + SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,char(9))); +} 10 +do_execsql_test 1.5 { + SELECT count(*) FROM t1 WHERE json(j0)==json(json_pretty(j0,'/*hello*/')); +} 10 + + +finish_test |