drh | 5517625 | 2008-01-22 14:50:16 +0000 | [diff] [blame] | 1 | # 2008 Jan 22 |
| 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 | # |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 12 | # $Id: filectrl.test,v 1.2 2008/11/21 00:10:35 aswift Exp $ |
drh | 5517625 | 2008-01-22 14:50:16 +0000 | [diff] [blame] | 13 | |
| 14 | set testdir [file dirname $argv0] |
| 15 | source $testdir/tester.tcl |
| 16 | |
| 17 | |
| 18 | do_test filectrl-1.1 { |
| 19 | file_control_test db |
| 20 | } {} |
| 21 | do_test filectrl-1.2 { |
| 22 | db eval {CREATE TEMP TABLE x(y);} |
| 23 | file_control_test db |
| 24 | } {} |
| 25 | do_test filectrl-1.3 { |
| 26 | db close |
| 27 | sqlite3 db :memory: |
| 28 | file_control_test db |
| 29 | } {} |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 30 | do_test filectrl-1.4 { |
| 31 | sqlite3 db test.db |
| 32 | file_control_lasterrno_test db |
| 33 | } {} |
| 34 | do_test filectrl-1.5 { |
| 35 | db close |
| 36 | sqlite3 db test_control_lockproxy.db |
mistachkin | f8a7846 | 2012-03-08 20:00:36 +0000 | [diff] [blame] | 37 | file_control_lockproxy_test db [get_pwd] |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 38 | } {} |
drh | 696b33e | 2012-12-06 19:01:42 +0000 | [diff] [blame] | 39 | do_test filectrl-1.6 { |
| 40 | sqlite3 db test.db |
| 41 | set fn [file_control_tempfilename db] |
drh | 696b33e | 2012-12-06 19:01:42 +0000 | [diff] [blame] | 42 | set fn |
| 43 | } {/etilqs_/} |
aswift | aebf413 | 2008-11-21 00:10:35 +0000 | [diff] [blame] | 44 | db close |
mistachkin | fda06be | 2011-08-02 00:57:34 +0000 | [diff] [blame] | 45 | forcedelete .test_control_lockproxy.db-conch test.proxy |
mistachkin | 1b361ff | 2016-05-03 19:36:54 +0000 | [diff] [blame^] | 46 | forcedelete test.db test2.db |
| 47 | |
| 48 | if {$tcl_platform(platform)=="windows"} { |
| 49 | do_test filectrl-2.1 { |
| 50 | sqlite3 db test2.db |
| 51 | set size [file size test2.db] |
| 52 | set handle [file_control_win32_get_handle db] |
| 53 | db close |
| 54 | forcedelete test2.db |
| 55 | list $size $handle [expr {$handle != 0}] |
| 56 | } {/^0 \{0 \d+\} 1$/} |
| 57 | |
| 58 | do_test filectrl-2.2 { |
| 59 | sqlite3 db test2.db |
| 60 | execsql { |
| 61 | CREATE TABLE t1(x); |
| 62 | INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576)); |
| 63 | } |
| 64 | set size [file size test2.db] |
| 65 | set handle [file_control_win32_get_handle db] |
| 66 | db close |
| 67 | forcedelete test2.db |
| 68 | list $size $handle [expr {$handle != 0}] |
| 69 | } {/^1\d+ \{0 \d+\} 1$/} |
| 70 | } |
| 71 | |
drh | 5517625 | 2008-01-22 14:50:16 +0000 | [diff] [blame] | 72 | finish_test |