interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / fts5 / test / fts5error.test

68 lines · 1713 bytes Raw Blame History
1# 2026 October 14
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#*************************************************************************
11# This file implements regression tests for SQLite library. The
12# focus of this script is testing the FTS5 module.
13#
14
15source [file join [file dirname [info script]] fts5_common.tcl]
16set testprefix fts5aa
17
18# If SQLITE_ENABLE_FTS5 is not defined, omit this file.
19ifcapable !fts5 {
20 finish_test
21 return
22}
23
24proc myupper {x} {
25 string toupper $x
26}
27db func myupper myupper
28
29do_test 0.1 {
30 myupper hello
31} {HELLO}
32
33do_execsql_test 1.0 {
34 CREATE TABLE t1(id INTEGER PRIMARY KEY, x, y);
35 INSERT INTO t1 VALUES(1, 'one', 'two');
36 INSERT INTO t1 VALUES(2, 'three', 'four');
37 CREATE VIEW v1 AS SELECT id, x, myupper(y) AS y FROM t1;
38
39 CREATE VIRTUAL TABLE ft1 USING fts5(x, y, content=v1, content_rowid=id);
40}
41
42do_execsql_test 1.1.1 {
43 INSERT INTO ft1(ft1) VALUES('rebuild');
44}
45do_execsql_test 1.1.2 {
46 SELECT snippet(ft1, -1, '[', ']', '...', 1) FROM ft1('one');
47} {{[one]}}
48do_execsql_test 1.1.3 {
49 INSERT INTO ft1(ft1, rank) VALUES('integrity-check', 1);
50} {}
51
52db close
53sqlite3 db test.db
54
55do_catchsql_test 1.2.1 {
56 INSERT INTO ft1(ft1) VALUES('rebuild');
57} {1 {no such function: myupper}}
58
59do_catchsql_test 1.2.2 {
60 SELECT snippet(ft1, -1, '[', ']', '...', 1) FROM ft1('one');
61} {1 {no such function: myupper}}
62
63do_catchsql_test 1.2.3 {
64 INSERT INTO ft1(ft1, rank) VALUES('integrity-check', 1);
65} {1 {no such function: myupper}}
66
67finish_test
68