Add a test case to cover the bug fixed in check-in (5007). (CVS 5008)

FossilOrigin-Name: 1863e87c40499ee3d9fd9cba6670e9a0e946d390
This commit is contained in:
drh 2008-04-15 00:01:59 +00:00
parent 4c02a23557
commit 110af53360
3 changed files with 62 additions and 6 deletions

View File

@ -1,5 +1,5 @@
C Do\snot\sattempt\sto\swrite\sto\stemporary\sdatabase\sfiles\sthat\shave\snever\nbeen\sopened.\s(CVS\s5007)
D 2008-04-14T23:13:46
C Add\sa\stest\scase\sto\scover\sthe\sbug\sfixed\sin\scheck-in\s(5007).\s(CVS\s5008)
D 2008-04-15T00:02:00
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -455,6 +455,7 @@ F test/sync.test ded6b39d8d8ca3c0c5518516c6371b3316d3e3a3
F test/table.test 13b1c2e2fb4727b35ee1fb7641fc469214fd2455
F test/tableapi.test 791f7e3891d9b70bdb43b311694bf5e9befcbc34
F test/tclsqlite.test 3fac87cb1059c46b8fa8a60b553f4f1adb0fb6d9
F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
F test/tester.tcl 7820fa85db914ef8cfff72b689fd4a9ed8712cec
F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7
@ -628,7 +629,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 7217cecee71fbc992acd07b4ac90c1929e2207ae
R 194436d9ba6587c6c80b28e6a123a043
P 7bb9a4165afb96043dfeffad21eb51591a1fd2dd
R 95872015313aa0ab31ee9558f8a82a98
U drh
Z 2222b7c4e7fa12d7b54bcf1718d13c6d
Z 490b66623347d3f07228780b8130d933

View File

@ -1 +1 @@
7bb9a4165afb96043dfeffad21eb51591a1fd2dd
1863e87c40499ee3d9fd9cba6670e9a0e946d390

55
test/tempdb.test Normal file
View File

@ -0,0 +1,55 @@
# 2008 April 14
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
# The focus of this file is in making sure that rolling back
# a statement journal works correctly.
#
# $Id: tempdb.test,v 1.1 2008/04/15 00:02:00 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
# Use a temporary database.
#
db close
sqlite3 db {}
# Force a statement journal rollback on a database file that
# has never been opened.
#
do_test tempdb-1.1 {
execsql {
BEGIN;
CREATE TABLE t1(x UNIQUE);
CREATE TABLE t2(y);
INSERT INTO t2 VALUES('hello');
INSERT INTO t2 VALUES(NULL);
}
# Because of the transaction, the temporary database file
# has not even been opened yet. The following statement
# will cause a statement journal rollback on this non-existant
# file.
catchsql {
INSERT INTO t1
SELECT CASE WHEN y IS NULL THEN test_error('oops', 11) ELSE y END
FROM t2;
}
} {1 oops}
# Verify that no writes occurred in t1.
#
do_test tempdb-1.2 {
execsql {
SELECT * FROM t1
}
} {}
finish_test