OLD | NEW |
1 # 2009 Nov 11 | 1 # 2009 Nov 11 |
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 # shell2-1.*: Misc. test of various tickets and reported errors. | 19 # shell2-1.*: Misc. test of various tickets and reported errors. |
20 # | 20 # |
21 set testdir [file dirname $argv0] | 21 set testdir [file dirname $argv0] |
22 source $testdir/tester.tcl | 22 source $testdir/tester.tcl |
23 if {$tcl_platform(platform)=="windows"} { | 23 set CLI [test_find_cli] |
24 set CLI "sqlite3.exe" | |
25 } else { | |
26 set CLI "./sqlite3" | |
27 } | |
28 if {![file executable $CLI]} { | |
29 finish_test | |
30 return | |
31 } | |
32 db close | 24 db close |
33 forcedelete test.db test.db-journal test.db-wal | 25 forcedelete test.db test.db-journal test.db-wal |
34 sqlite3 db test.db | 26 sqlite3 db test.db |
35 | 27 |
36 | 28 |
37 #---------------------------------------------------------------------------- | 29 #---------------------------------------------------------------------------- |
38 # shell2-1.*: Misc. test of various tickets and reported errors. | 30 # shell2-1.*: Misc. test of various tickets and reported errors. |
39 # | 31 # |
40 | 32 |
41 # Batch mode not creating databases. | 33 # Batch mode not creating databases. |
42 # Reported on mailing list by Ken Zalewski. | 34 # Reported on mailing list by Ken Zalewski. |
43 # Ticket [aeff892c57]. | 35 # Ticket [aeff892c57]. |
44 do_test shell2-1.1.1 { | 36 do_test shell2-1.1.1 { |
45 forcedelete foo.db | 37 forcedelete foo.db |
46 set rc [ catchcmd "-batch foo.db" "CREATE TABLE t1(a);" ] | 38 set rc [ catchcmd "-batch foo.db" "CREATE TABLE t1(a);" ] |
47 set fexist [file exist foo.db] | 39 set fexist [file exist foo.db] |
48 list $rc $fexist | 40 list $rc $fexist |
49 } {{0 {}} 1} | 41 } {{0 {}} 1} |
50 | 42 |
51 # Shell silently ignores extra parameters. | 43 # Shell silently ignores extra parameters. |
52 # Ticket [f5cb008a65]. | 44 # Ticket [f5cb008a65]. |
53 do_test shell2-1.2.1 { | 45 do_test shell2-1.2.1 { |
54 set rc [catch { eval exec $CLI \":memory:\" \"select 3\" \"select 4\" } msg] | 46 set rc [catch { eval exec $CLI \":memory:\" \"select+3\" \"select+4\" } msg] |
55 list $rc $msg | 47 list $rc $msg |
56 } {0 {3 | 48 } {0 {3 |
57 4}} | 49 4}} |
58 | 50 |
59 # Test a problem reported on the mailing list. The shell was at one point | 51 # Test a problem reported on the mailing list. The shell was at one point |
60 # returning the generic SQLITE_ERROR message ("SQL error or missing database") | 52 # returning the generic SQLITE_ERROR message ("SQL error or missing database") |
61 # instead of the "too many levels..." message in the test below. | 53 # instead of the "too many levels..." message in the test below. |
62 # | 54 # |
63 do_test shell2-1.3 { | 55 do_test shell2-1.3 { |
64 catchcmd "-batch test.db" { | 56 catchcmd "-batch test.db" { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 a | 182 a |
191 1 | 183 1 |
192 2 | 184 2 |
193 SELECT * FROM foo2; | 185 SELECT * FROM foo2; |
194 b | 186 b |
195 1 | 187 1 |
196 2 | 188 2 |
197 }} | 189 }} |
198 | 190 |
199 finish_test | 191 finish_test |
OLD | NEW |