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 # The focus of this file is testing the CLI shell tool.
14 # $Id: shell2.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $
19 # shell3-1.*: Basic tests for running SQL statments from command line.
20 # shell3-2.*: Basic tests for running SQL file from command line.
22 set testdir [file dirname $argv0]
23 source $testdir/tester.tcl
24 if {$tcl_platform(platform)=="windows"} {
29 if {![file executable $CLI]} {
34 forcedelete test.db test.db-journal test.db-wal
37 #----------------------------------------------------------------------------
38 # shell3-1.*: Basic tests for running SQL statments from command line.
41 # Run SQL statement from command line
44 set rc [ catchcmd "foo.db \"CREATE TABLE t1(a);\"" ]
45 set fexist [file exist foo.db]
49 catchcmd "foo.db" ".tables"
52 catchcmd "foo.db \"DROP TABLE t1;\""
55 catchcmd "foo.db" ".tables"
58 catchcmd "foo.db \"CREATE TABLE t1(a); DROP TABLE t1;\""
61 catchcmd "foo.db" ".tables"
64 catchcmd "foo.db \"CREATE TABLE\""
65 } {1 {Error: near "TABLE": syntax error}}
67 #----------------------------------------------------------------------------
68 # shell3-2.*: Basic tests for running SQL file from command line.
71 # Run SQL file from command line
74 set rc [ catchcmd "foo.db" "CREATE TABLE t1(a);" ]
75 set fexist [file exist foo.db]
79 catchcmd "foo.db" ".tables"
82 catchcmd "foo.db" "DROP TABLE t1;"
85 catchcmd "foo.db" ".tables"
88 catchcmd "foo.db" "CREATE TABLE t1(a); DROP TABLE t1;"
91 catchcmd "foo.db" ".tables"
94 catchcmd "foo.db" "CREATE TABLE"
95 } {1 {Error: incomplete SQL: CREATE TABLE}}