Snapshot of upstream SQLite 3.40.1
[sqlcipher.git] / ext / rbu / rburename.test
blob2275396bcaa9450ecfc4f63c6c1ece6e487bc798
1 # 2022 November 07
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
14 source [file join [file dirname [info script]] rbu_common.tcl]
15 set ::testprefix rburename
18 do_execsql_test 1.0 {
19   CREATE TABLE t1(a, b);
20   INSERT INTO t1 VALUES(1, 2);
21   INSERT INTO t1 VALUES(3, 4);
22   INSERT INTO t1 VALUES(5, 6);
25 forcedelete test.db-vacuum
27 proc my_rename {old new} {
28   lappend ::my_rename_calls [list [file tail $old] [file tail $new]]
29   file rename $old $new
32 do_test 1.1 {
33   sqlite3rbu_vacuum rbu test.db
34   rbu rename_handler my_rename
35   while {[rbu step]=="SQLITE_OK"} {}
36   rbu close
37 } SQLITE_DONE
39 do_test 1.2 {
40   set ::my_rename_calls
41 } {{test.db-oal test.db-wal}}
43 proc my_rename {old new} {
44   error "something went wrong"
47 do_test 1.3 {
48   sqlite3rbu_vacuum rbu test.db
49   rbu rename_handler my_rename
50   while {[rbu step]=="SQLITE_OK"} {}
51   list [catch { rbu close } msg] $msg
52 } {1 SQLITE_IOERR}
54 finish_test