0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-11-25 00:49:41 +01:00
sqlite/ext/rbu/rbumisc.test
dan ad5536fca1 Add another test case to cover a previously uncovered branch in the RBU module.
FossilOrigin-Name: 30392985612c51d4583a905f8fe766f08cd31b86d0e30a977adc6a6705649e00
2019-05-08 21:14:48 +00:00

81 lines
1.9 KiB
Plaintext

# 2014 August 30
#
# 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.
#
#***********************************************************************
#
source [file join [file dirname [info script]] rbu_common.tcl]
set ::testprefix rbumisc
db close
sqlite3_shutdown
sqlite3_config_uri 1
reset_db
#-------------------------------------------------------------------------
# Ensure that RBU is not confused by oddly named tables in an RBU
# database.
#
do_execsql_test 1.0 {
CREATE TABLE x1(a, b, c INTEGER PRIMARY KEY);
}
do_test 1.1 {
forcedelete rbu.db
sqlite3 rbu rbu.db
rbu eval {
CREATE TABLE data_x1(a, b, c, rbu_control);
INSERT INTO data_x1 VALUES(1, 1, 1, 0);
INSERT INTO data_x1 VALUES(2, 2, 2, 0);
CREATE TABLE dat(a, b, c, rbu_control);
CREATE TABLE "data x1"(a, b, c, rbu_control);
CREATE TABLE datax1(a, b, c, rbu_control);
CREATE TABLE data_(a, b, c, rbu_control);
INSERT INTO "data x1" VALUES(3, 3, 3, 0);
INSERT INTO datax1 VALUES(3, 3, 3, 0);
INSERT INTO data_ VALUES(3, 3, 3, 0);
INSERT INTO dat VALUES(3, 3, 3, 0);
}
rbu close
} {}
do_test 1.2 {
step_rbu test.db rbu.db
db eval { SELECT * FROM x1 }
} {1 1 1 2 2 2}
do_test 1.3 {
db eval { DELETE FROM x1 }
sqlite3 rbu rbu.db
rbu eval { DELETE FROM rbu_state }
rbu close
step_rbu test.db rbu.db
db eval { SELECT * FROM x1 }
} {1 1 1 2 2 2}
do_test 1.4 {
db eval { DELETE FROM x1 }
sqlite3 rbu rbu.db
rbu eval { DELETE FROM rbu_state }
rbu close
sqlite3rbu rbu test.db rbu.db
rbu step
rbu step
rbu close
forcecopy test.db-oal test.db-wal
sqlite3rbu rbu test.db rbu.db
rbu step
list [catch { rbu close } msg] $msg
} {1 {SQLITE_ERROR - cannot update wal mode database}}
finish_test