1# 2022 November 07 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# 12# 13 14source [file join [file dirname [info script]] rbu_common.tcl] 15set ::testprefix rburename 16 17 18do_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); 23} 24 25forcedelete test.db-vacuum 26 27proc my_rename {old new} { 28 lappend ::my_rename_calls [list [file tail $old] [file tail $new]] 29 file rename $old $new 30} 31 32do_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 38 39do_test 1.2 { 40 set ::my_rename_calls 41} {{test.db-oal test.db-wal}} 42 43proc my_rename {old new} { 44 error "something went wrong" 45} 46 47do_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} 53 54finish_test 55