Debian Codegraph @

ext/fts5/test/fts5circref.test

raw
1 # 2018 Dec 22
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
15 source [file join [file dirname [info script]] fts5_common.tcl]
16 set testprefix fts5circref
17
18 # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
19 ifcapable !fts5 {
20 finish_test
21 return
22 }
23
24 do_execsql_test 1.0 {
25 CREATE VIRTUAL TABLE tt USING fts5(a);
26 SELECT name FROM sqlite_master ORDER BY 1;
27 } {
28 tt tt_config tt_content tt_data tt_docsize tt_idx
29 }
30 db_save_and_close
31
32 foreach {tn schema sql} {
33 1 {
34 CREATE TRIGGER tr1 AFTER INSERT ON tt_config BEGIN
35 SELECT * FROM tt;
36 END;
37 } {
38 INSERT INTO tt(tt, rank) VALUES('usermerge', 4);
39 }
40
41 2 {
42 CREATE TRIGGER tr1 AFTER INSERT ON tt_docsize BEGIN
43 SELECT * FROM tt;
44 END;
45 } {
46 INSERT INTO tt(a) VALUES('one two three');
47 }
48
49 3 {
50 CREATE TRIGGER tr1 AFTER INSERT ON tt_content BEGIN
51 SELECT * FROM tt;
52 END;
53 } {
54 INSERT INTO tt(a) VALUES('one two three');
55 }
56
57 4 {
58 CREATE TRIGGER tr1 AFTER INSERT ON tt_data BEGIN
59 SELECT * FROM tt;
60 END;
61 } {
62 INSERT INTO tt(a) VALUES('one two three');
63 }
64
65 5 {
66 CREATE TRIGGER tr1 AFTER INSERT ON tt_idx BEGIN
67 SELECT * FROM tt;
68 END;
69 } {
70 INSERT INTO tt(a) VALUES('one two three');
71 }
72 } {
73 db_restore_and_reopen
74 do_execsql_test 1.1.$tn.1 $schema
75 do_catchsql_test 1.1.$tn.2 $sql {1 {database disk image is malformed}}
76 db close
77 }
78
79
80 finish_test