tkt3997.test 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # 2001 September 15
  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. #
  12. # Tests to make sure #3997 is fixed.
  13. #
  14. # $Id: tkt3997.test,v 1.1 2009/07/28 13:30:31 danielk1977 Exp $
  15. set testdir [file dirname $argv0]
  16. source $testdir/tester.tcl
  17. proc reverse {lhs rhs} {
  18. return [string compare $rhs $lhs]
  19. }
  20. proc usual {lhs rhs} {
  21. return [string compare $lhs $rhs]
  22. }
  23. db collate reverse reverse
  24. db collate usual usual
  25. do_test tkt3997-1.1 {
  26. execsql {
  27. create table mytext(name BLOB);
  28. INSERT INTO mytext VALUES('abc');
  29. INSERT INTO mytext VALUES('acd');
  30. INSERT INTO mytext VALUES('afe');
  31. }
  32. } {}
  33. do_test tkt3997-1.2 {
  34. execsql {
  35. SELECT name
  36. FROM mytext
  37. ORDER BY name COLLATE reverse
  38. }
  39. } {afe acd abc}
  40. do_test tkt3997-1.3 {
  41. execsql {
  42. SELECT name
  43. FROM (SELECT name FROM mytext)
  44. ORDER BY name COLLATE reverse
  45. }
  46. } {afe acd abc}
  47. do_test tkt3997-2.1 {
  48. execsql {
  49. CREATE TABLE mytext2(name COLLATE reverse);
  50. INSERT INTO mytext2 SELECT name FROM mytext;
  51. }
  52. } {}
  53. do_test tkt3997-2.2 {
  54. execsql {
  55. SELECT name
  56. FROM (SELECT name FROM mytext2)
  57. ORDER BY name
  58. }
  59. } {afe acd abc}
  60. do_test tkt3997-2.3 {
  61. execsql {
  62. SELECT name
  63. FROM (SELECT name FROM mytext2)
  64. ORDER BY name COLLATE usual
  65. }
  66. } {abc acd afe}
  67. finish_test