960e8c6317
FossilOrigin-Name: 1f0197d504fa2bde15b287ac6c0102cacdb1e482
81 lines
2.3 KiB
Plaintext
81 lines
2.3 KiB
Plaintext
# Copyright (c) 1999, 2000 D. Richard Hipp
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2 of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public
|
|
# License along with this library; if not, write to the
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
# Boston, MA 02111-1307, USA.
|
|
#
|
|
# Author contact information:
|
|
# drh@hwaci.com
|
|
# http://www.hwaci.com/drh/
|
|
#
|
|
#***********************************************************************
|
|
# 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.1 2001/04/03 16:53:22 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
|