mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-11-14 10:07:09 +00:00
9ed72eb5ae
This merges the version-3.45.1 tag from upstream SQLite git repository to libSQL with the following conflicts resolved: Conflicts: README.md ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/configure libsql-sqlite3/doc/jsonb.md libsql-sqlite3/ext/fts5/test/fts5faultH.test libsql-sqlite3/ext/fts5/test/fts5origintext.test libsql-sqlite3/ext/fts5/test/fts5origintext2.test libsql-sqlite3/ext/fts5/test/fts5origintext3.test libsql-sqlite3/ext/fts5/test/fts5origintext4.test libsql-sqlite3/ext/fts5/test/fts5origintext5.test libsql-sqlite3/ext/fts5/test/fts5secure8.test libsql-sqlite3/ext/fts5/test/fts5tokenizer2.test libsql-sqlite3/ext/fts5/test/fts5trigram2.test libsql-sqlite3/ext/jni/src/org/sqlite/jni/annotation/Experimental.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqlLogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java libsql-sqlite3/ext/wasm/GNUmakefile libsql-sqlite3/ext/wasm/batch-runner-sahpool.html libsql-sqlite3/ext/wasm/batch-runner-sahpool.js libsql-sqlite3/src/pager.c libsql-sqlite3/src/shell.c.in libsql-sqlite3/src/sqliteInt.h libsql-sqlite3/src/wal.c libsql-sqlite3/test/fts3integrity.test libsql-sqlite3/test/json/jsonb-q1.txt libsql-sqlite3/test/json106.test libsql-sqlite3/test/json107.test libsql-sqlite3/test/jsonb01.test libsql-sqlite3/test/mmapcorrupt.test libsql-sqlite3/test/releasetest_data.tcl libsql-sqlite3/test/shell9.test libsql-sqlite3/test/wapp.tcl libsql-sqlite3/test/wapptest.tcl
110 lines
3.0 KiB
Plaintext
110 lines
3.0 KiB
Plaintext
# 2023 October 24
|
|
#
|
|
# 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.
|
|
#
|
|
#*************************************************************************
|
|
#
|
|
# Tests for the fts5 "trigram" tokenizer.
|
|
#
|
|
|
|
source [file join [file dirname [info script]] fts5_common.tcl]
|
|
ifcapable !fts5 { finish_test ; return }
|
|
set ::testprefix fts5trigram2
|
|
|
|
do_execsql_test 1.0 "
|
|
CREATE VIRTUAL TABLE t1 USING fts5(y, tokenize='trigram remove_diacritics 1');
|
|
INSERT INTO t1 VALUES('abc\u0303defghijklm');
|
|
INSERT INTO t1 VALUES('a\u0303b\u0303c\u0303defghijklm');
|
|
"
|
|
|
|
do_execsql_test 1.1 {
|
|
SELECT highlight(t1, 0, '(', ')') FROM t1('abc');
|
|
} [list \
|
|
"(abc\u0303)defghijklm" \
|
|
"(a\u0303b\u0303c\u0303)defghijklm" \
|
|
]
|
|
|
|
do_execsql_test 1.2 {
|
|
SELECT highlight(t1, 0, '(', ')') FROM t1('bcde');
|
|
} [list \
|
|
"a(bc\u0303de)fghijklm" \
|
|
"a\u0303(b\u0303c\u0303de)fghijklm" \
|
|
]
|
|
|
|
do_execsql_test 1.3 {
|
|
SELECT highlight(t1, 0, '(', ')') FROM t1('cdef');
|
|
} [list \
|
|
"ab(c\u0303def)ghijklm" \
|
|
"a\u0303b\u0303(c\u0303def)ghijklm" \
|
|
]
|
|
|
|
do_execsql_test 1.4 {
|
|
SELECT highlight(t1, 0, '(', ')') FROM t1('def');
|
|
} [list \
|
|
"abc\u0303(def)ghijklm" \
|
|
"a\u0303b\u0303c\u0303(def)ghijklm" \
|
|
]
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
do_catchsql_test 2.0 {
|
|
CREATE VIRTUAL TABLE t2 USING fts5(
|
|
z, tokenize='trigram case_sensitive 1 remove_diacritics 1'
|
|
);
|
|
} {1 {error in tokenizer constructor}}
|
|
|
|
do_execsql_test 2.1 {
|
|
CREATE VIRTUAL TABLE t2 USING fts5(
|
|
z, tokenize='trigram case_sensitive 0 remove_diacritics 1'
|
|
);
|
|
}
|
|
do_execsql_test 2.2 "
|
|
INSERT INTO t2 VALUES('\u00E3bcdef');
|
|
INSERT INTO t2 VALUES('b\u00E3cdef');
|
|
INSERT INTO t2 VALUES('bc\u00E3def');
|
|
INSERT INTO t2 VALUES('bcd\u00E3ef');
|
|
"
|
|
|
|
do_execsql_test 2.3 {
|
|
SELECT highlight(t2, 0, '(', ')') FROM t2('abc');
|
|
} "(\u00E3bc)def"
|
|
do_execsql_test 2.4 {
|
|
SELECT highlight(t2, 0, '(', ')') FROM t2('bac');
|
|
} "(b\u00E3c)def"
|
|
do_execsql_test 2.5 {
|
|
SELECT highlight(t2, 0, '(', ')') FROM t2('bca');
|
|
} "(bc\u00E3)def"
|
|
do_execsql_test 2.6 "
|
|
SELECT highlight(t2, 0, '(', ')') FROM t2('\u00E3bc');
|
|
" "(\u00E3bc)def"
|
|
|
|
#-------------------------------------------------------------------------
|
|
do_execsql_test 3.0 {
|
|
CREATE VIRTUAL TABLE t3 USING fts5(
|
|
z, tokenize='trigram remove_diacritics 1'
|
|
);
|
|
} {}
|
|
do_execsql_test 3.1 "
|
|
INSERT INTO t3 VALUES ('\u0303abc\u0303');
|
|
"
|
|
do_execsql_test 3.2 {
|
|
SELECT highlight(t3, 0, '(', ')') FROM t3('abc');
|
|
} "\u0303(abc\u0303)"
|
|
|
|
#-------------------------------------------------------------------------
|
|
do_execsql_test 4.0 {
|
|
CREATE VIRTUAL TABLE t4 USING fts5(z, tokenize=trigram);
|
|
} {}
|
|
|
|
breakpoint
|
|
do_execsql_test 4.1 {
|
|
INSERT INTO t4 VALUES('ABCD');
|
|
} {}
|
|
|
|
finish_test
|