drh | 8ce10ba | 2003-06-22 01:41:49 +0000 | [diff] [blame] | 1 | # 2003 June 21 |
| 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. |
| 12 | # |
| 13 | # This file implements tests for miscellanous features that were |
| 14 | # left out of other test files. |
| 15 | # |
drh | d60ccc6 | 2003-06-24 10:39:46 +0000 | [diff] [blame^] | 16 | # $Id: misc2.test,v 1.2 2003/06/24 10:39:46 drh Exp $ |
drh | 8ce10ba | 2003-06-22 01:41:49 +0000 | [diff] [blame] | 17 | |
| 18 | set testdir [file dirname $argv0] |
| 19 | source $testdir/tester.tcl |
| 20 | |
| 21 | # Test for ticket #360 |
| 22 | # |
| 23 | do_test misc2-1.1 { |
| 24 | catchsql { |
| 25 | CREATE TABLE FOO(bar integer); |
| 26 | CREATE TRIGGER foo_insert BEFORE INSERT ON foo BEGIN |
| 27 | SELECT CASE WHEN (NOT new.bar BETWEEN 0 AND 20) |
| 28 | THEN raise(rollback, 'aiieee') END; |
| 29 | END; |
| 30 | INSERT INTO foo(bar) VALUES (1); |
| 31 | } |
| 32 | } {1 aiieee} |
drh | d60ccc6 | 2003-06-24 10:39:46 +0000 | [diff] [blame^] | 33 | |
| 34 | # Make sure ROWID works on a view and a subquery. Ticket #364 |
| 35 | # |
| 36 | do_test misc2-2.1 { |
| 37 | execsql { |
| 38 | CREATE TABLE t1(a,b,c); |
| 39 | INSERT INTO t1 VALUES(1,2,3); |
| 40 | CREATE TABLE t2(x,y,z); |
| 41 | INSERT INTO t2 VALUES(7,8,9); |
| 42 | SELECT rowid, * FROM (SELECT * FROM t1, t2); |
| 43 | } |
| 44 | } {{} 1 2 3 7 8 9} |
| 45 | do_test misc2-2.2 { |
| 46 | execsql { |
| 47 | CREATE VIEW v1 AS SELECT * FROM t1, t2; |
| 48 | SELECT rowid, * FROM v1; |
| 49 | } |
| 50 | } {{} 1 2 3 7 8 9} |