diff options
author | danielk1977 <danielk1977@noemail.net> | 2005-01-20 02:17:01 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2005-01-20 02:17:01 +0000 |
commit | 4489f9bdece56d35df259b8cd1946900b63f89cc (patch) | |
tree | 50e441faccc28aa3adf7cf1c5f3a6885ac839cef /test | |
parent | 1bd3644f27470e6446a9c2c21ccdd2a2aeffa565 (diff) | |
download | sqlite-4489f9bdece56d35df259b8cd1946900b63f89cc.tar.gz sqlite-4489f9bdece56d35df259b8cd1946900b63f89cc.zip |
Fix some test scripts so that they work with a minimal build configuration. (CVS 2241)
FossilOrigin-Name: d267fb3ca3f31ee138c9613cb84e873ede7f141a
Diffstat (limited to 'test')
-rw-r--r-- | test/bind.test | 10 | ||||
-rw-r--r-- | test/corrupt.test | 6 | ||||
-rw-r--r-- | test/func.test | 6 | ||||
-rw-r--r-- | test/index2.test | 6 | ||||
-rw-r--r-- | test/limit.test | 52 | ||||
-rw-r--r-- | test/misc2.test | 50 | ||||
-rw-r--r-- | test/misc4.test | 42 | ||||
-rw-r--r-- | test/pager.test | 36 | ||||
-rwxr-xr-x | test/progress.test | 9 |
9 files changed, 120 insertions, 97 deletions
diff --git a/test/bind.test b/test/bind.test index 8bdc7af93..5ac134403 100644 --- a/test/bind.test +++ b/test/bind.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script testing the sqlite_bind API. # -# $Id: bind.test,v 1.26 2005/01/12 00:08:25 drh Exp $ +# $Id: bind.test,v 1.27 2005/01/20 02:17:02 danielk1977 Exp $ # set testdir [file dirname $argv0] @@ -494,8 +494,10 @@ catch {sqlite3_finalize $VM} # Make sure we catch an unterminated "(" in a Tcl-style variable name # -do_test bind-11.1 { - catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;} -} {1 {unrecognized token: "$abc(123"}} +ifcapable tclvar { + do_test bind-11.1 { + catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;} + } {1 {unrecognized token: "$abc(123"}} +} finish_test diff --git a/test/corrupt.test b/test/corrupt.test index 823c4976c..d771aba27 100644 --- a/test/corrupt.test +++ b/test/corrupt.test @@ -13,7 +13,7 @@ # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # -# $Id: corrupt.test,v 1.3 2005/01/17 07:53:44 danielk1977 Exp $ +# $Id: corrupt.test,v 1.4 2005/01/20 02:17:02 danielk1977 Exp $ catch {file delete -force test.db} catch {file delete -force test.db-journal} @@ -43,9 +43,9 @@ do_test corrupt-1.1 { CREATE TABLE t2 AS SELECT * FROM t1; DELETE FROM t2 WHERE rowid%5!=0; COMMIT; - PRAGMA integrity_check; } -} {ok} +} {} +integrity_check corrupt-1.2 # Copy file $from into $to # diff --git a/test/func.test b/test/func.test index 1d8560070..2ffa8bacd 100644 --- a/test/func.test +++ b/test/func.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing built-in functions. # -# $Id: func.test,v 1.31 2005/01/11 16:54:15 drh Exp $ +# $Id: func.test,v 1.32 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -248,7 +248,9 @@ do_test func-7.1 { # Tests for aggregate functions and how they handle NULLs. # do_test func-8.1 { - execsql {EXPLAIN SELECT sum(a) FROM t2;} + ifcapable explain { + execsql {EXPLAIN SELECT sum(a) FROM t2;} + } execsql { SELECT sum(a), count(a), round(avg(a),2), min(a), max(a), count(*) FROM t2; } diff --git a/test/index2.test b/test/index2.test index e230f069e..174212cb3 100644 --- a/test/index2.test +++ b/test/index2.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE INDEX statement. # -# $Id: index2.test,v 1.1 2005/01/11 16:54:15 drh Exp $ +# $Id: index2.test,v 1.2 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -65,7 +65,9 @@ do_test index2-2.1 { execsql $sql } {} do_test index2-2.2 { - execsql {EXPLAIN SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5} + ifcapable explain { + execsql {EXPLAIN SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5} + } execsql {SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5, c6 LIMIT 5} } {9 10009 20009 30009 40009} diff --git a/test/limit.test b/test/limit.test index 4e2f5f7e1..118cc542b 100644 --- a/test/limit.test +++ b/test/limit.test @@ -12,7 +12,7 @@ # focus of this file is testing the LIMIT ... OFFSET ... clause # of SELECT statements. # -# $Id: limit.test,v 1.20 2005/01/15 01:52:33 drh Exp $ +# $Id: limit.test,v 1.21 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -331,29 +331,31 @@ do_test limit-9.2 { SELECT * FROM (SELECT * FROM t7 LIMIT 3); } } {1 2 3} -do_test limit-9.3 { - execsql { - SELECT * FROM (SELECT * FROM t6 LIMIT 3) - UNION - SELECT * FROM (SELECT * FROM t7 LIMIT 3) - ORDER BY 1 - } -} {1 2 3} -do_test limit-9.4 { - execsql { - SELECT * FROM (SELECT * FROM t6 LIMIT 3) - UNION - SELECT * FROM (SELECT * FROM t7 LIMIT 3) - ORDER BY 1 - LIMIT 2 - } -} {1 2} -do_test limit-9.5 { - catchsql { - SELECT * FROM t6 LIMIT 3 - UNION - SELECT * FROM t7 LIMIT 3 - } -} {1 {LIMIT clause should come after UNION not before}} +ifcapable compound { + do_test limit-9.3 { + execsql { + SELECT * FROM (SELECT * FROM t6 LIMIT 3) + UNION + SELECT * FROM (SELECT * FROM t7 LIMIT 3) + ORDER BY 1 + } + } {1 2 3} + do_test limit-9.4 { + execsql { + SELECT * FROM (SELECT * FROM t6 LIMIT 3) + UNION + SELECT * FROM (SELECT * FROM t7 LIMIT 3) + ORDER BY 1 + LIMIT 2 + } + } {1 2} + do_test limit-9.5 { + catchsql { + SELECT * FROM t6 LIMIT 3 + UNION + SELECT * FROM t7 LIMIT 3 + } + } {1 {LIMIT clause should come after UNION not before}} +} finish_test diff --git a/test/misc2.test b/test/misc2.test index ae503f785..6a22b613a 100644 --- a/test/misc2.test +++ b/test/misc2.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc2.test,v 1.18 2004/11/22 15:05:59 danielk1977 Exp $ +# $Id: misc2.test,v 1.19 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -166,29 +166,33 @@ do_test misc2-7.2 { } msg] lappend rc $msg } {1 {database table is locked}} -do_test misc2-7.3 { - db close - file delete -force test.db - sqlite3 db :memory: - execsql { - CREATE TABLE t1(x); - INSERT INTO t1 VALUES(1); - } - set rc [catch { - db eval {SELECT rowid FROM t1} {} { - db eval "DELETE FROM t1 WHERE rowid=$rowid" +ifcapable memorydb { + do_test misc2-7.3 { + sqlite3 db :memory: + execsql { + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(1); } - } msg] - lappend rc $msg -} {1 {database table is locked}} -do_test misc2-7.4 { - set rc [catch { - db eval {SELECT rowid FROM t1} {} { - db eval "INSERT INTO t1 VALUES(3)" - } - } msg] - lappend rc $msg -} {1 {database table is locked}} + set rc [catch { + db eval {SELECT rowid FROM t1} {} { + db eval "DELETE FROM t1 WHERE rowid=$rowid" + } + } msg] + lappend rc $msg + } {1 {database table is locked}} + do_test misc2-7.4 { + set rc [catch { + db eval {SELECT rowid FROM t1} {} { + db eval "INSERT INTO t1 VALUES(3)" + } + } msg] + lappend rc $msg + } {1 {database table is locked}} +} + +db close +file delete -force test.db +sqlite3 db test.db # Ticket #453. If the SQL ended with "-", the tokenizer was calling that # an incomplete token, which caused problem. The solution was to just call diff --git a/test/misc4.test b/test/misc4.test index d09860843..ed3d65a1b 100644 --- a/test/misc4.test +++ b/test/misc4.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc4.test,v 1.11 2005/01/18 17:20:10 drh Exp $ +# $Id: misc4.test,v 1.12 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -122,24 +122,26 @@ do_test misc4-4.1 { # Ticket #1036. When creating tables from a SELECT on a view, use the # short names of columns. # -do_test misc4-5.1 { - execsql { - create table t4(a,b); - create table t5(a,c); - insert into t4 values (1,2); - insert into t5 values (1,3); - create view myview as select t4.a a from t4 inner join t5 on t4.a=t5.a; - create table problem as select * from myview; - } - execsql2 { - select * FROM problem; - } -} {a 1} -do_test misc4-5.2 { - execsql2 { - create table t6 as select * from t4, t5; - select * from t6; - } -} {a 1 b 2 a:1 1 c 3} +ifcapable view { + do_test misc4-5.1 { + execsql { + create table t4(a,b); + create table t5(a,c); + insert into t4 values (1,2); + insert into t5 values (1,3); + create view myview as select t4.a a from t4 inner join t5 on t4.a=t5.a; + create table problem as select * from myview; + } + execsql2 { + select * FROM problem; + } + } {a 1} + do_test misc4-5.2 { + execsql2 { + create table t6 as select * from t4, t5; + select * from t6; + } + } {a 1 b 2 a:1 1 c 3} +} finish_test diff --git a/test/pager.test b/test/pager.test index 6b6cfdcd1..4fdef97c4 100644 --- a/test/pager.test +++ b/test/pager.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is page cache subsystem. # -# $Id: pager.test,v 1.21 2005/01/19 03:47:16 danielk1977 Exp $ +# $Id: pager.test,v 1.22 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] @@ -403,22 +403,24 @@ do_test pager-4.6.1 { } {} # Test truncate on an in-memory database is Ok. -do_test pager-4.6.2 { - set ::p2 [pager_open :memory: 10] - pager_truncate $::p2 5 -} {} -do_test pager-4.6.3 { - for {set i 1} {$i<5} {incr i} { - set p [page_get $::p2 $i] - page_write $p "Page $i" - page_unref $p - pager_commit $::p2 - } - pager_truncate $::p2 3 -} {} -do_test pager-4.6.4 { - pager_close $::p2 -} {} +ifcapable memorydb { + do_test pager-4.6.2 { + set ::p2 [pager_open :memory: 10] + pager_truncate $::p2 5 + } {} + do_test pager-4.6.3 { + for {set i 1} {$i<5} {incr i} { + set p [page_get $::p2 $i] + page_write $p "Page $i" + page_unref $p + pager_commit $::p2 + } + pager_truncate $::p2 3 + } {} + do_test pager-4.6.4 { + pager_close $::p2 + } {} +} do_test pager-4.99 { pager_close $::p1 diff --git a/test/progress.test b/test/progress.test index 3e97d72fd..5a0d18648 100755 --- a/test/progress.test +++ b/test/progress.test @@ -11,11 +11,18 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the 'progress callback'. # -# $Id: progress.test,v 1.4 2004/10/18 21:34:47 drh Exp $ +# $Id: progress.test,v 1.5 2005/01/20 02:17:02 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl +# If the progress callback is not available in this build, skip this +# whole file. +ifcapable !progress { + finish_test + return +} + # Build some test data # execsql { |