OLD | NEW |
| (Empty) |
1 # 2014 June 17 | |
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 # | |
12 | |
13 source [file join [file dirname [info script]] fts5_common.tcl] | |
14 set testprefix fts5eb | |
15 | |
16 # If SQLITE_ENABLE_FTS5 is defined, omit this file. | |
17 ifcapable !fts5 { | |
18 finish_test | |
19 return | |
20 } | |
21 | |
22 proc do_syntax_error_test {tn expr err} { | |
23 set ::se_expr $expr | |
24 do_catchsql_test $tn {SELECT fts5_expr($se_expr)} [list 1 $err] | |
25 } | |
26 | |
27 proc do_syntax_test {tn expr res} { | |
28 set ::se_expr $expr | |
29 do_execsql_test $tn {SELECT fts5_expr($se_expr)} [list $res] | |
30 } | |
31 | |
32 foreach {tn expr res} { | |
33 1 {abc} {"abc"} | |
34 2 {abc ""} {"abc"} | |
35 3 {""} {} | |
36 4 {abc OR ""} {"abc"} | |
37 5 {abc NOT ""} {"abc"} | |
38 6 {abc AND ""} {"abc"} | |
39 7 {"" OR abc} {"abc"} | |
40 8 {"" NOT abc} {"abc"} | |
41 9 {"" AND abc} {"abc"} | |
42 10 {abc + "" + def} {"abc" + "def"} | |
43 11 {abc "" def} {"abc" AND "def"} | |
44 12 {r+e OR w} {"r" + "e" OR "w"} | |
45 } { | |
46 do_execsql_test 1.$tn {SELECT fts5_expr($expr)} [list $res] | |
47 } | |
48 | |
49 do_catchsql_test 2.1 { | |
50 SELECT fts5_expr() | |
51 } {1 {wrong number of arguments to function fts5_expr}} | |
52 | |
53 do_catchsql_test 2.1 { | |
54 SELECT fts5_expr_tcl() | |
55 } {1 {wrong number of arguments to function fts5_expr_tcl}} | |
56 | |
57 finish_test | |
58 | |
59 | |
60 | |
OLD | NEW |