fts-9fd058691.test 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. set testdir [file dirname $argv0]
  15. source $testdir/tester.tcl
  16. # If SQLITE_ENABLE_FTS3 is defined, omit this file.
  17. ifcapable !fts3 {
  18. finish_test
  19. return
  20. }
  21. set ::testprefix fts3-9fd058691
  22. do_execsql_test 1.0 {
  23. CREATE VIRTUAL TABLE fts USING fts3( tags TEXT);
  24. INSERT INTO fts (tags) VALUES ('tag1');
  25. SELECT * FROM fts WHERE tags MATCH 'tag1';
  26. } {tag1}
  27. do_test 1.1 {
  28. db close
  29. sqlite3 db test.db
  30. execsql {
  31. UPDATE fts SET tags = 'tag1' WHERE rowid = 1;
  32. SELECT * FROM fts WHERE tags MATCH 'tag1';
  33. }
  34. } {tag1}
  35. db close
  36. forcedelete test.db
  37. sqlite3 db test.db
  38. do_execsql_test 2.0 {
  39. CREATE VIRTUAL TABLE fts USING fts3(tags TEXT);
  40. INSERT INTO fts (docid, tags) VALUES (1, 'tag1');
  41. INSERT INTO fts (docid, tags) VALUES (2, NULL);
  42. INSERT INTO fts (docid, tags) VALUES (3, 'three');
  43. } {}
  44. do_test 2.1 {
  45. execsql {
  46. UPDATE fts SET tags = 'two' WHERE rowid = 2;
  47. SELECT * FROM fts WHERE tags MATCH 'two';
  48. }
  49. } {two}
  50. finish_test