Fix a typo inside an assert() statement introduced by the previous commit.
[sqlite.git] / test / close.test
blob99bc7255e2d7aacf3024f79140f6dc0b228e3a5a
1 # 2013 May 14
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # Test some specific circumstances to do with shared cache mode.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set ::testprefix close
20 # This module bypasses the "-key" logic in tester.tcl, so it cannot run
21 # with the codec enabled.
22 do_not_use_codec
24 do_execsql_test 1.0 {
25   CREATE TABLE t1(x);
26   INSERT INTO t1 VALUES('one');
27   INSERT INTO t1 VALUES('two');
28   INSERT INTO t1 VALUES('three');
30 db close
32 do_test 1.1 {
33   set DB [sqlite3_open test.db]
34   sqlite3_close_v2 $DB
35 } {SQLITE_OK}
37 do_test 1.2.1 {
38   set DB [sqlite3_open test.db]
39   set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
40   sqlite3_close_v2 $DB
41 } {SQLITE_OK}
42 do_test 1.2.2 {
43   sqlite3_finalize $STMT
44 } {SQLITE_OK}
46 do_test 1.3.1 {
47   set DB [sqlite3_open test.db]
48   set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
49   sqlite3_step $STMT
50   sqlite3_close_v2 $DB
51 } {SQLITE_OK}
53 do_test 1.3.2 {
54   sqlite3_column_text $STMT 0
55 } {one}
57 do_test 1.3.3 {
58   sqlite3_finalize $STMT
59 } {SQLITE_OK}
61 do_test 1.4.1 {
62   set DB [sqlite3_open test.db]
63   set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
64   sqlite3_step $STMT
65   sqlite3_close_v2 $DB
66 } {SQLITE_OK}
68 do_test 1.4.2 {
69   list [sqlite3_step $STMT] [sqlite3_column_text $STMT 0]
70 } {SQLITE_ROW two}
72 do_test 1.4.3 {
73   list [catch {
74     sqlite3_prepare $DB "SELECT * FROM sqlite_master" -1 dummy
75   } msg] $msg
76 } {1 {(21) bad parameter or other API misuse}}
78 do_test 1.4.4 {
79   sqlite3_finalize $STMT
80 } {SQLITE_OK}
82 finish_test