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 set CLI [test_find_cli]
26 forcedelete test.db test.db-journal test.db-wal
29 # There are inconsistencies in command-line argument quoting on Windows.
30 # In particular, individual applications are responsible for command-line
31 # parsing in Windows, not the shell. Depending on whether the sqlite3.exe
32 # program is compiled with MinGW or MSVC, the command-line parsing is
33 # different. This causes problems for the tests below. To avoid
34 # issues, these tests are disabled for windows.
36 if {$::tcl_platform(platform)=="windows"} {
41 #----------------------------------------------------------------------------
42 # shell3-1.*: Basic tests for running SQL statments from command line.
45 # Run SQL statement from command line
48 set rc [ catchcmd "foo.db \"CREATE TABLE t1(a);\"" ]
49 set fexist [file exist foo.db]
53 catchcmd "foo.db" ".tables"
56 catchcmd "foo.db \"DROP TABLE t1;\""
59 catchcmd "foo.db" ".tables"
62 catchcmd "foo.db \"CREATE TABLE t1(a); DROP TABLE t1;\""
65 catchcmd "foo.db" ".tables"
68 catchcmd "foo.db \"CREATE TABLE\""
69 } {1 {Error: near "TABLE": syntax error}}
71 #----------------------------------------------------------------------------
72 # shell3-2.*: Basic tests for running SQL file from command line.
75 # Run SQL file from command line
78 set rc [ catchcmd "foo.db" "CREATE TABLE t1(a);" ]
79 set fexist [file exist foo.db]
83 catchcmd "foo.db" ".tables"
86 catchcmd "foo.db" "DROP TABLE t1;"
89 catchcmd "foo.db" ".tables"
92 catchcmd "foo.db" "CREATE TABLE t1(a); DROP TABLE t1;"
95 catchcmd "foo.db" ".tables"
98 catchcmd "foo.db" "CREATE TABLE"
99 } {1 {Error: near line 1: near "TABLE": syntax error}}