blob: ea79886b8cfe40fcbdd533436140dfee7eee3f35 [file] [log] [blame]
drhb19a2bc2001-09-16 00:13:26 +00001# 2001 September 15
drh960e8c62001-04-03 16:53:21 +00002#
drhb19a2bc2001-09-16 00:13:26 +00003# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
drh960e8c62001-04-03 16:53:21 +00005#
drhb19a2bc2001-09-16 00:13:26 +00006# 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.
drh960e8c62001-04-03 16:53:21 +00009#
10#***********************************************************************
11# This file implements regression tests for TCL interface to the
12# SQLite library.
13#
14# Actually, all tests are based on the TCL interface, so the main
15# interface is pretty well tested. This file contains some addition
16# tests for fringe issues that the main test suite does not cover.
17#
drhb19a2bc2001-09-16 00:13:26 +000018# $Id: tclsqlite.test,v 1.2 2001/09/16 00:13:28 drh Exp $
drh960e8c62001-04-03 16:53:21 +000019
20set testdir [file dirname $argv0]
21source $testdir/tester.tcl
22
23# Check the error messages generated by tclsqlite
24#
25do_test tcl-1.1 {
26 set v [catch {sqlite bogus} msg]
27 lappend v $msg
28} {1 {wrong # args: should be "sqlite HANDLE FILENAME ?MODE?"}}
29do_test tcl-1.2 {
30 set v [catch {db bogus} msg]
31 lappend v $msg
32} {1 {bad option "bogus": must be busy, close, complete, eval, or timeout}}
33do_test tcl-1.3 {
34 execsql {CREATE TABLE t1(a int, b int)}
35 execsql {INSERT INTO t1 VALUES(10,20)}
36 set v [catch {
37 db eval {SELECT * FROM t1} data {
38 error "The error message"
39 }
40 } msg]
41 lappend v $msg
42} {1 {The error message}}
43do_test tcl-1.4 {
44 set v [catch {
45 db eval {SELECT * FROM t2} data {
46 error "The error message"
47 }
48 } msg]
49 lappend v $msg
50} {1 {no such table: t2}}
51do_test tcl-1.5 {
52 set v [catch {
53 db eval {SELECT * FROM t1} data {
54 break
55 }
56 } msg]
57 lappend v $msg
58} {0 {}}
59do_test tcl-1.6 {
60 set v [catch {
61 db eval {SELECT * FROM t1} data {
62 expr x*
63 }
64 } msg]
65 lappend v $msg
66} {1 {syntax error in expression "x*"}}
67
68finish_test