0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-12-16 13:48:52 +00:00
libsql/libsql-sqlite3/test/json502.test
2023-10-16 13:58:16 +02:00

41 lines
1.1 KiB
Plaintext

# 2023-04-28
#
# 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.
#
#***********************************************************************
# This file implements tests for the JSON5 enhancements to the
# JSON SQL functions extension to the SQLite library.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix json502
ifcapable vtab {
do_execsql_test 1.1 {
CREATE TABLE t1(x JSON);
INSERT INTO t1(x) VALUES('{a:{b:{c:"hello",},},}');
SELECT fullkey FROM t1, json_tree(x);
} {{$} {$.a} {$.a.b} {$.a.b.c}}
}
do_execsql_test 2.1 {
SELECT json_error_position('{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}');
} 9
do_catchsql_test 2.2 {
SELECT json('{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}');
} {1 {malformed JSON}}
do_catchsql_test 2.3 {
SELECT '{a:null,{"h":[1,[1,2,3]],"j":"abc"}:true}'->'$h[#-1]';
} {1 {malformed JSON}}
finish_test