github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/testdata/tcl/fts-9fd058691.test (about) 1 # 2011 October 13 2 # 3 # May you do good and not evil. 4 # May you find forgiveness for yourself and forgive others. 5 # May you share freely, never taking more than you give. 6 # 7 #*********************************************************************** 8 # 9 # This file implements regression tests for the FTS SQLite module. 10 # 11 # This file implements tests to verify that ticket [9fd058691] has been 12 # fixed. 13 # 14 15 set testdir [file dirname $argv0] 16 source $testdir/tester.tcl 17 18 # If SQLITE_ENABLE_FTS3 is defined, omit this file. 19 ifcapable !fts3 { 20 finish_test 21 return 22 } 23 24 set ::testprefix fts3-9fd058691 25 26 do_execsql_test 1.0 { 27 CREATE VIRTUAL TABLE fts USING fts3( tags TEXT); 28 INSERT INTO fts (tags) VALUES ('tag1'); 29 SELECT * FROM fts WHERE tags MATCH 'tag1'; 30 } {tag1} 31 32 do_test 1.1 { 33 db close 34 sqlite3 db test.db 35 execsql { 36 UPDATE fts SET tags = 'tag1' WHERE rowid = 1; 37 SELECT * FROM fts WHERE tags MATCH 'tag1'; 38 } 39 } {tag1} 40 41 db close 42 forcedelete test.db 43 sqlite3 db test.db 44 45 do_execsql_test 2.0 { 46 CREATE VIRTUAL TABLE fts USING fts3(tags TEXT); 47 INSERT INTO fts (docid, tags) VALUES (1, 'tag1'); 48 INSERT INTO fts (docid, tags) VALUES (2, NULL); 49 INSERT INTO fts (docid, tags) VALUES (3, 'three'); 50 } {} 51 52 do_test 2.1 { 53 execsql { 54 UPDATE fts SET tags = 'two' WHERE rowid = 2; 55 SELECT * FROM fts WHERE tags MATCH 'two'; 56 } 57 } {two} 58 59 finish_test