Enhance the command-line completion extension to return the names of
[sqlite.git] / test / tkt-bdc6bbbb38.test
blob8b0d55df84c2d1ff96699288ad47e26f3f2a807e
1 # 2012 May 11
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests to verify that ticket [bdc6bbbb38] has been
14 # fixed.  
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
19 set testprefix tkt-bdc6bbbb38
21 # If SQLITE_ENABLE_FTS3 is defined, omit this file.
22 ifcapable !fts3 { finish_test ; return }
23 set sqlite_fts3_enable_parentheses 1
25 foreach {tn idxdir} {1 ASC 2 DESC} {
26   execsql { DROP TABLE IF EXISTS t2 }
28   do_execsql_test $tn.1.1 "CREATE VIRTUAL TABLE t2 USING fts4(x, order=$idxdir)"
29   do_execsql_test $tn.1.2 { INSERT INTO t2 VALUES('a b c') }
31   do_execsql_test $tn.1.3 {
32     SELECT offsets(t2) FROM t2 WHERE t2 MATCH 'a AND d OR b' ORDER BY docid ASC
33   } {
34     {0 0 0 1 0 2 2 1}
35   }
36   do_execsql_test $tn.1.4 {
37     SELECT snippet(t2,'[',']') FROM t2 WHERE t2 MATCH 'a AND d OR b' 
38     ORDER BY docid ASC
39   } {
40     {[a] [b] c}
41   }
42   do_execsql_test $tn.1.5 { INSERT INTO t2 VALUES('a c d') }
43   do_execsql_test $tn.1.6 {
44     SELECT offsets(t2) FROM t2 WHERE t2 MATCH 'a AND d OR b' ORDER BY docid ASC
45   } {
46     {0 0 0 1 0 2 2 1}
47     {0 0 0 1 0 1 4 1}
48   }
49   do_execsql_test $tn.1.7 {
50     SELECT snippet(t2,'[',']') FROM t2 WHERE t2 MATCH 'a AND d OR b'
51     ORDER BY docid ASC
52   } {
53     {[a] [b] c}
54     {[a] c [d]}
55   }
57   execsql { DROP TABLE IF EXISTS t3 }
58   do_execsql_test $tn.2.1 "CREATE VIRTUAL TABLE t3 USING fts4(x, order=$idxdir)"
59   do_execsql_test $tn.2.2 { INSERT INTO t3 VALUES('a c d') }
60   do_execsql_test $tn.2.3 {
61     SELECT offsets(t3) FROM t3 WHERE t3 MATCH 'a AND d OR b' ORDER BY docid DESC
62   } {
63     {0 0 0 1 0 1 4 1}
64   }
65   do_execsql_test $tn.2.4 {
66     SELECT snippet(t3,'[',']') FROM t3 WHERE t3 MATCH 'a AND d OR b'
67       ORDER BY docid DESC
68   } {
69     {[a] c [d]}
70   }
71   do_execsql_test $tn.2.5 { 
72     INSERT INTO t3 VALUES('a b c');
73   }
74   do_execsql_test $tn.2.6 {
75     SELECT offsets(t3) FROM t3 WHERE t3 MATCH 'a AND d OR b' ORDER BY docid DESC
76   } {
77     {0 0 0 1 0 2 2 1}
78     {0 0 0 1 0 1 4 1}
79   }
80   do_execsql_test $tn.2.7 {
81     SELECT snippet(t3,'[',']') FROM t3 WHERE t3 MATCH 'a AND d OR b'
82       ORDER BY docid DESC
83   } {
84     {[a] [b] c}
85     {[a] c [d]}
86   }
89 set sqlite_fts3_enable_parentheses 0
90 finish_test