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 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the sqlite3SafetyOn and sqlite3SafetyOff
13 # functions. Those routines are not strictly necessary - they are
14 # designed to detect misuse of the library.
16 # $Id: safety.test,v 1.1 2005/01/11 15:28:33 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
23 set DB [sqlite3 db test.db]
24 db eval {CREATE TABLE t1(a)}
25 sqlite_set_magic $DB SQLITE_MAGIC_BUSY
27 SELECT name FROM sqlite_master;
29 } {1 {library routine called out of sequence}}
31 sqlite_set_magic $DB SQLITE_MAGIC_OPEN
33 SELECT name FROM sqlite_master
38 proc safety_on {} "sqlite_set_magic $DB SQLITE_MAGIC_BUSY"
39 db function safety_on safety_on
41 SELECT safety_on(), name FROM sqlite_master
43 } {1 {library routine called out of sequence}}
48 } {1 {library routine called out of sequence}}
53 sqlite_set_magic $DB SQLITE_MAGIC_OPEN
55 SELECT name FROM sqlite_master
61 db eval {SELECT name FROM sqlite_master} {
62 sqlite_set_magic $DB SQLITE_MAGIC_BUSY
66 } {1 {library routine called out of sequence}}
67 sqlite_set_magic $DB SQLITE_MAGIC_OPEN