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
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17
18# If SQLITE_ENABLE_FTS3 is defined, omit this file.
19ifcapable !fts3 {
20  finish_test
21  return
22}
23
24set ::testprefix fts3-9fd058691
25
26do_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
32do_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
41db close
42forcedelete test.db
43sqlite3 db test.db
44
45do_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
52do_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
59finish_test
60