fts5circref.test 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # 2018 Dec 22
  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
  12. # focus of this script is testing the FTS5 module.
  13. #
  14. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5circref
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.0 {
  22. CREATE VIRTUAL TABLE tt USING fts5(a);
  23. SELECT name FROM sqlite_master ORDER BY 1;
  24. } {
  25. tt tt_config tt_content tt_data tt_docsize tt_idx
  26. }
  27. db_save_and_close
  28. foreach {tn schema sql} {
  29. 1 {
  30. CREATE TRIGGER tr1 AFTER INSERT ON tt_config BEGIN
  31. SELECT * FROM tt;
  32. END;
  33. } {
  34. INSERT INTO tt(tt, rank) VALUES('usermerge', 4);
  35. }
  36. 2 {
  37. CREATE TRIGGER tr1 AFTER INSERT ON tt_docsize BEGIN
  38. SELECT * FROM tt;
  39. END;
  40. } {
  41. INSERT INTO tt(a) VALUES('one two three');
  42. }
  43. 3 {
  44. CREATE TRIGGER tr1 AFTER INSERT ON tt_content BEGIN
  45. SELECT * FROM tt;
  46. END;
  47. } {
  48. INSERT INTO tt(a) VALUES('one two three');
  49. }
  50. 4 {
  51. CREATE TRIGGER tr1 AFTER INSERT ON tt_data BEGIN
  52. SELECT * FROM tt;
  53. END;
  54. } {
  55. INSERT INTO tt(a) VALUES('one two three');
  56. }
  57. 5 {
  58. CREATE TRIGGER tr1 AFTER INSERT ON tt_idx BEGIN
  59. SELECT * FROM tt;
  60. END;
  61. } {
  62. INSERT INTO tt(a) VALUES('one two three');
  63. }
  64. } {
  65. db_restore_and_reopen
  66. do_execsql_test 1.1.$tn.1 $schema
  67. do_catchsql_test 1.1.$tn.2 $sql {1 {SQL logic error}}
  68. db close
  69. }
  70. finish_test