mirror of
https://github.com/sqlite/sqlite.git
synced 2026-10-25 09:59:22 +03:00
69 lines
1.7 KiB
Plaintext
69 lines
1.7 KiB
Plaintext
# 2026 October 14
|
|
#
|
|
# 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 regression tests for SQLite library. The
|
|
# focus of this script is testing the FTS5 module.
|
|
#
|
|
|
|
source [file join [file dirname [info script]] fts5_common.tcl]
|
|
set testprefix fts5aa
|
|
|
|
# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
|
|
ifcapable !fts5 {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
proc myupper {x} {
|
|
string toupper $x
|
|
}
|
|
db func myupper myupper
|
|
|
|
do_test 0.1 {
|
|
myupper hello
|
|
} {HELLO}
|
|
|
|
do_execsql_test 1.0 {
|
|
CREATE TABLE t1(id INTEGER PRIMARY KEY, x, y);
|
|
INSERT INTO t1 VALUES(1, 'one', 'two');
|
|
INSERT INTO t1 VALUES(2, 'three', 'four');
|
|
CREATE VIEW v1 AS SELECT id, x, myupper(y) AS y FROM t1;
|
|
|
|
CREATE VIRTUAL TABLE ft1 USING fts5(x, y, content=v1, content_rowid=id);
|
|
}
|
|
|
|
do_execsql_test 1.1.1 {
|
|
INSERT INTO ft1(ft1) VALUES('rebuild');
|
|
}
|
|
do_execsql_test 1.1.2 {
|
|
SELECT snippet(ft1, -1, '[', ']', '...', 1) FROM ft1('one');
|
|
} {{[one]}}
|
|
do_execsql_test 1.1.3 {
|
|
INSERT INTO ft1(ft1, rank) VALUES('integrity-check', 1);
|
|
} {}
|
|
|
|
db close
|
|
sqlite3 db test.db
|
|
|
|
do_catchsql_test 1.2.1 {
|
|
INSERT INTO ft1(ft1) VALUES('rebuild');
|
|
} {1 {no such function: myupper}}
|
|
|
|
do_catchsql_test 1.2.2 {
|
|
SELECT snippet(ft1, -1, '[', ']', '...', 1) FROM ft1('one');
|
|
} {1 {no such function: myupper}}
|
|
|
|
do_catchsql_test 1.2.3 {
|
|
INSERT INTO ft1(ft1, rank) VALUES('integrity-check', 1);
|
|
} {1 {no such function: myupper}}
|
|
|
|
finish_test
|
|
|