# 2001 September 15 # # 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. # #*********************************************************************** # This file implements regression tests for TCL interface to the # SQLite library. # # Actually, all tests are based on the TCL interface, so the main # interface is pretty well tested. This file contains some addition # tests for fringe issues that the main test suite does not cover. # # $Id: tclsqlite.test,v 1.2 2001/09/16 00:13:28 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Check the error messages generated by tclsqlite # do_test tcl-1.1 { set v [catch {sqlite bogus} msg] lappend v $msg } {1 {wrong # args: should be "sqlite HANDLE FILENAME ?MODE?"}} do_test tcl-1.2 { set v [catch {db bogus} msg] lappend v $msg } {1 {bad option "bogus": must be busy, close, complete, eval, or timeout}} do_test tcl-1.3 { execsql {CREATE TABLE t1(a int, b int)} execsql {INSERT INTO t1 VALUES(10,20)} set v [catch { db eval {SELECT * FROM t1} data { error "The error message" } } msg] lappend v $msg } {1 {The error message}} do_test tcl-1.4 { set v [catch { db eval {SELECT * FROM t2} data { error "The error message" } } msg] lappend v $msg } {1 {no such table: t2}} do_test tcl-1.5 { set v [catch { db eval {SELECT * FROM t1} data { break } } msg] lappend v $msg } {0 {}} do_test tcl-1.6 { set v [catch { db eval {SELECT * FROM t1} data { expr x* } } msg] lappend v $msg } {1 {syntax error in expression "x*"}} finish_test