mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Add tests cases for the zipfile extension.
FossilOrigin-Name: 13b786dafd308b7aef42328f26fe64981c83d524e4bf82ceb7d58afc7146c7d3
This commit is contained in:
67
test/zipfilefault.test
Normal file
67
test/zipfilefault.test
Normal file
@ -0,0 +1,67 @@
|
||||
# 2018 January 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.
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
source $testdir/malloc_common.tcl
|
||||
set testprefix zipfilefault
|
||||
|
||||
ifcapable !vtab {
|
||||
finish_test; return
|
||||
}
|
||||
if {[catch {load_static_extension db zipfile} error]} {
|
||||
puts "Skipping zipfile2 tests, hit load error: $error"
|
||||
finish_test; return
|
||||
}
|
||||
|
||||
faultsim_save_and_close
|
||||
do_faultsim_test 1 -prep {
|
||||
faultsim_restore_and_reopen
|
||||
load_static_extension db zipfile
|
||||
execsql { DROP TABLE IF EXISTS aaa }
|
||||
} -body {
|
||||
execsql { CREATE VIRTUAL TABLE aaa USING zipfile('test.zip') }
|
||||
} -test {
|
||||
faultsim_test_result {0 {}}
|
||||
}
|
||||
|
||||
forcedelete test.zip
|
||||
sqlite3 db test.db
|
||||
load_static_extension db zipfile
|
||||
do_execsql_test 2.0 {
|
||||
CREATE VIRTUAL TABLE setup USING zipfile('test.zip');
|
||||
INSERT INTO setup(name, data) VALUES('a.txt', '1234567890');
|
||||
}
|
||||
|
||||
do_faultsim_test 2 -faults oom* -body {
|
||||
execsql { SELECT name,data FROM zipfile('test.zip') }
|
||||
} -test {
|
||||
faultsim_test_result {0 {a.txt 1234567890}}
|
||||
}
|
||||
|
||||
forcedelete test.zip
|
||||
reset_db
|
||||
load_static_extension db zipfile
|
||||
do_execsql_test 3.0 {
|
||||
CREATE VIRTUAL TABLE setup USING zipfile('test.zip');
|
||||
INSERT INTO setup(name, data) VALUES('a.txt', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
}
|
||||
|
||||
do_faultsim_test 2 -faults oom* -body {
|
||||
execsql { SELECT name,data FROM zipfile('test.zip') }
|
||||
} -test {
|
||||
faultsim_test_result {0 {a.txt aaaaaaaaaaaaaaaaaaaaaaaaaaaa}}
|
||||
}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user