diff options
author | Jan Mercl <0xjnml@gmail.com> | 2020-07-26 22:36:18 +0200 |
---|---|---|
committer | Jan Mercl <0xjnml@gmail.com> | 2020-07-26 22:36:18 +0200 |
commit | b406626c64313ae348996c243a0a05d3f6ed2c3c (patch) | |
tree | 0eaae4fa6348b150568725e6f2ec0b4c4203b5f8 /testdata/tcl/incrblobfault.test | |
parent | d8d9f40ce80062793349c0ea47520b6878312f4a (diff) |
release v1.4.0-beta1v1.4.0-beta1
Diffstat (limited to 'testdata/tcl/incrblobfault.test')
-rw-r--r-- | testdata/tcl/incrblobfault.test | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/testdata/tcl/incrblobfault.test b/testdata/tcl/incrblobfault.test new file mode 100644 index 0000000..10c2c8e --- /dev/null +++ b/testdata/tcl/incrblobfault.test @@ -0,0 +1,69 @@ +# 2010 October 26 +# +# 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. +# +#*********************************************************************** +# +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +set testprefix incrblobfault + +do_execsql_test 1.0 { + CREATE TABLE blob(x INTEGER PRIMARY KEY, v BLOB); + INSERT INTO blob VALUES(1, 'hello world'); + INSERT INTO blob VALUES(2, 'world hello'); + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; + INSERT INTO blob SELECT NULL, v FROM blob; +} + +do_faultsim_test 1 -prep { + sqlite3 db test.db + set ::blob [db incrblob blob v 1] +} -body { + if {[catch {sqlite3_blob_reopen $::blob 1000}]} { + error [sqlite3_errmsg db] + } +} -test { + faultsim_test_result {0 {}} + close $::blob +} + +do_faultsim_test 2 -prep { + sqlite3 db test.db + set ::blob [db incrblob blob v 1] +} -body { + if {[catch {sqlite3_blob_reopen $::blob -1}]} { + error [sqlite3_errmsg db] + } +} -test { + faultsim_test_result {1 {no such rowid: -1}} {1 {disk I/O error}} + close $::blob +} + +do_faultsim_test 3 -prep { + sqlite3 db test.db +} -body { + set ::blob [db incrblob blob v 1] + gets $::blob +} -test { + faultsim_test_result {0 {hello world}} + catch { close $::blob } +} + +finish_test |