OLD | NEW |
1 # 2009 Dec 16 | 1 # 2009 Dec 16 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # | 11 # |
12 # The focus of this file is testing the CLI shell tool. | 12 # The focus of this file is testing the CLI shell tool. |
13 # | 13 # |
14 # $Id: shell2.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ | 14 # $Id: shell2.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ |
15 # | 15 # |
16 | 16 |
17 # Test plan: | 17 # Test plan: |
18 # | 18 # |
19 # shell3-1.*: Basic tests for running SQL statments from command line. | 19 # shell3-1.*: Basic tests for running SQL statments from command line. |
20 # shell3-2.*: Basic tests for running SQL file from command line. | 20 # shell3-2.*: Basic tests for running SQL file from command line. |
21 # | 21 # |
22 set testdir [file dirname $argv0] | 22 set testdir [file dirname $argv0] |
23 source $testdir/tester.tcl | 23 source $testdir/tester.tcl |
24 if {$tcl_platform(platform)=="windows"} { | 24 set CLI [test_find_cli] |
25 set CLI "sqlite3.exe" | |
26 } else { | |
27 set CLI "./sqlite3" | |
28 } | |
29 if {![file executable $CLI]} { | |
30 finish_test | |
31 return | |
32 } | |
33 db close | 25 db close |
34 forcedelete test.db test.db-journal test.db-wal | 26 forcedelete test.db test.db-journal test.db-wal |
35 sqlite3 db test.db | 27 sqlite3 db test.db |
36 | 28 |
| 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. |
| 35 # |
| 36 if {$::tcl_platform(platform)=="windows"} { |
| 37 finish_test |
| 38 return |
| 39 } |
| 40 |
37 #---------------------------------------------------------------------------- | 41 #---------------------------------------------------------------------------- |
38 # shell3-1.*: Basic tests for running SQL statments from command line. | 42 # shell3-1.*: Basic tests for running SQL statments from command line. |
39 # | 43 # |
40 | 44 |
41 # Run SQL statement from command line | 45 # Run SQL statement from command line |
42 do_test shell3-1.1 { | 46 do_test shell3-1.1 { |
43 forcedelete foo.db | 47 forcedelete foo.db |
44 set rc [ catchcmd "foo.db \"CREATE TABLE t1(a);\"" ] | 48 set rc [ catchcmd "foo.db \"CREATE TABLE t1(a);\"" ] |
45 set fexist [file exist foo.db] | 49 set fexist [file exist foo.db] |
46 list $rc $fexist | 50 list $rc $fexist |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 catchcmd "foo.db" ".tables" | 89 catchcmd "foo.db" ".tables" |
86 } {0 {}} | 90 } {0 {}} |
87 do_test shell3-2.5 { | 91 do_test shell3-2.5 { |
88 catchcmd "foo.db" "CREATE TABLE t1(a); DROP TABLE t1;" | 92 catchcmd "foo.db" "CREATE TABLE t1(a); DROP TABLE t1;" |
89 } {0 {}} | 93 } {0 {}} |
90 do_test shell3-2.6 { | 94 do_test shell3-2.6 { |
91 catchcmd "foo.db" ".tables" | 95 catchcmd "foo.db" ".tables" |
92 } {0 {}} | 96 } {0 {}} |
93 do_test shell3-2.7 { | 97 do_test shell3-2.7 { |
94 catchcmd "foo.db" "CREATE TABLE" | 98 catchcmd "foo.db" "CREATE TABLE" |
95 } {1 {Error: incomplete SQL: CREATE TABLE}} | 99 } {1 {Error: near line 1: near "TABLE": syntax error}} |
96 | 100 |
97 finish_test | 101 finish_test |
OLD | NEW |