fts1m.test 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # 2007 July 27
  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. # This file implements regression tests for SQLite library. The focus
  12. # of this script is testing the FTS1 module, specifically snippet
  13. # generation. Extracted from fts2o.test.
  14. #
  15. # $Id: fts1m.test,v 1.1 2007/07/25 00:25:20 shess Exp $
  16. #
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. # If SQLITE_ENABLE_FTS1 is not defined, omit this file.
  20. ifcapable !fts1 {
  21. finish_test
  22. return
  23. }
  24. #---------------------------------------------------------------------
  25. # These tests, fts1m-1.*, test that ticket #2429 is fixed.
  26. #
  27. db eval {
  28. CREATE VIRTUAL TABLE t1 USING fts1(a, b, c);
  29. INSERT INTO t1(a, b, c) VALUES('one three four', 'one four', 'one four two');
  30. }
  31. do_test fts1m-1.1 {
  32. execsql {
  33. SELECT rowid, snippet(t1) FROM t1 WHERE c MATCH 'four';
  34. }
  35. } {1 {one <b>four</b> two}}
  36. do_test fts1m-1.2 {
  37. execsql {
  38. SELECT rowid, snippet(t1) FROM t1 WHERE b MATCH 'four';
  39. }
  40. } {1 {one <b>four</b>}}
  41. do_test fts1m-1.3 {
  42. execsql {
  43. SELECT rowid, snippet(t1) FROM t1 WHERE a MATCH 'four';
  44. }
  45. } {1 {one three <b>four</b>}}
  46. finish_test