interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / rbu / rburename.test

55 lines · 1250 bytes Raw Blame History
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]
15if_no_rbu_support { finish_test ; return }
16set ::testprefix rburename
17
18
19do_execsql_test 1.0 {
20 CREATE TABLE t1(a, b);
21 INSERT INTO t1 VALUES(1, 2);
22 INSERT INTO t1 VALUES(3, 4);
23 INSERT INTO t1 VALUES(5, 6);
24}
25
26forcedelete test.db-vacuum
27
28proc my_rename {old new} {
29 lappend ::my_rename_calls [list [file tail $old] [file tail $new]]
30 file rename $old $new
31}
32
33do_test 1.1 {
34 sqlite3rbu_vacuum rbu test.db
35 rbu rename_handler my_rename
36 while {[rbu step]=="SQLITE_OK"} {}
37 rbu close
38} SQLITE_DONE
39
40do_test 1.2 {
41 set ::my_rename_calls
42} {{test.db-oal test.db-wal}}
43
44proc my_rename {old new} {
45 error "something went wrong"
46}
47
48do_test 1.3 {
49 sqlite3rbu_vacuum rbu test.db
50 rbu rename_handler my_rename
51 while {[rbu step]=="SQLITE_OK"} {}
52 list [catch { rbu close } msg] $msg
53} {1 SQLITE_IOERR}
54
55finish_test