Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Move the shell test scripts into the test/ subfolder so that they are run automatically by "make test". |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
9fb7da6904e479f4671eeebf1a4b7e4e |
User & Date: | drh 2012-04-24 12:46:05.097 |
Context
2012-04-24
| ||
13:14 | New test cases for the ".dump" and ".mode insert" commands of the shell. (check-in: dfce856976 user: drh tags: trunk) | |
12:46 | Move the shell test scripts into the test/ subfolder so that they are run automatically by "make test". (check-in: 9fb7da6904 user: drh tags: trunk) | |
12:12 | Fix a sign-extension problem for BLOB output in ".insert" mode of the command-line shell. (check-in: 282f2a74c2 user: drh tags: trunk) | |
Changes
Name change from tool/shell1.test to test/shell1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2009 Nov 11 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # The focus of this file is testing the CLI shell tool. # | < | | | | < < < < < < | < < < | | < | < < < | < < | < < < < < | < < < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # 2009 Nov 11 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # The focus of this file is testing the CLI shell tool. # # # Test plan: # # shell1-1.*: Basic command line option handling. # shell1-2.*: Basic "dot" command token parsing. # shell1-3.*: Basic test that "dot" command can be called. # set testdir [file dirname $argv0] source $testdir/tester.tcl if {$tcl_platform(platform)=="windows"} { set CLI "sqlite3.exe" } else { set CLI "./sqlite3" } if {![file executable $CLI]} { finish_test return } db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db #---------------------------------------------------------------------------- # Test cases shell1-1.*: Basic command line option handling. # # invalid option |
︙ | ︙ | |||
713 714 715 716 717 718 719 | } {1 {Error: unknown command or invalid arguments: "timer". Enter ".help" for help}} do_test shell1-3-28.1 { catchcmd test.db \ ".log stdout\nSELECT coalesce(sqlite_log(123,'hello'),'456');" } "0 {(123) hello\n456}" | | | 687 688 689 690 691 692 693 694 | } {1 {Error: unknown command or invalid arguments: "timer". Enter ".help" for help}} do_test shell1-3-28.1 { catchcmd test.db \ ".log stdout\nSELECT coalesce(sqlite_log(123,'hello'),'456');" } "0 {(123) hello\n456}" finish_test |
Name change from tool/shell2.test to test/shell2.test.
︙ | ︙ | |||
14 15 16 17 18 19 20 | # $Id: shell2.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ # # Test plan: # # shell2-1.*: Misc. test of various tickets and reported errors. # | | | | | < < < < < < | < < < | | < | < < < | < < | < < < < < | < < < < < | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # $Id: shell2.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ # # Test plan: # # shell2-1.*: Misc. test of various tickets and reported errors. # set testdir [file dirname $argv0] source $testdir/tester.tcl if {$tcl_platform(platform)=="windows"} { set CLI "sqlite3.exe" } else { set CLI "./sqlite3" } if {![file executable $CLI]} { finish_test return } db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db #---------------------------------------------------------------------------- # shell2-1.*: Misc. test of various tickets and reported errors. # |
︙ | ︙ | |||
215 216 217 218 219 220 221 | 1 2 SELECT * FROM foo2; b 1 2}} | | | 190 191 192 193 194 195 196 197 | 1 2 SELECT * FROM foo2; b 1 2}} finish_test |
Name change from tool/shell3.test to test/shell3.test.
︙ | ︙ | |||
15 16 17 18 19 20 21 | # # Test plan: # # shell3-1.*: Basic tests for running SQL statments from command line. # shell3-2.*: Basic tests for running SQL file from command line. # | | | | | < < < < < < | < < < | | < | < < < | < < | < < < < < | < < < < < | < | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # # Test plan: # # shell3-1.*: Basic tests for running SQL statments from command line. # shell3-2.*: Basic tests for running SQL file from command line. # set testdir [file dirname $argv0] source $testdir/tester.tcl if {$tcl_platform(platform)=="windows"} { set CLI "sqlite3.exe" } else { set CLI "./sqlite3" } if {![file executable $CLI]} { finish_test return } db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db #---------------------------------------------------------------------------- # shell3-1.*: Basic tests for running SQL statments from command line. # # Run SQL statement from command line do_test shell3-1.1 { |
︙ | ︙ | |||
116 117 118 119 120 121 122 | do_test shell3-2.6 { catchcmd "foo.db" ".tables" } {0 {}} do_test shell3-2.7 { catchcmd "foo.db" "CREATE TABLE" } {1 {Error: incomplete SQL: CREATE TABLE}} | | < | 90 91 92 93 94 95 96 97 | do_test shell3-2.6 { catchcmd "foo.db" ".tables" } {0 {}} do_test shell3-2.7 { catchcmd "foo.db" "CREATE TABLE" } {1 {Error: incomplete SQL: CREATE TABLE}} finish_test |
Name change from tool/shell4.test to test/shell4.test.
︙ | ︙ | |||
15 16 17 18 19 20 21 | # $Id: shell4.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ # # Test plan: # # shell4-1.*: Basic tests specific to the "stats" command. # | | | | < < | < < | < < < | | < | < < < < | < < | | | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # $Id: shell4.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ # # Test plan: # # shell4-1.*: Basic tests specific to the "stats" command. # set testdir [file dirname $argv0] source $testdir/tester.tcl if {$tcl_platform(platform)=="windows"} { set CLI "sqlite3.exe" } else { set CLI "./sqlite3" } if {![file executable $CLI]} { finish_test return } db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db #---------------------------------------------------------------------------- # Test cases shell4-1.*: Tests specific to the "stats" command. # # should default to off do_test shell4-1.1.1 { |
︙ | ︙ | |||
122 123 124 125 126 127 128 | SELECT 1; }] list [regexp {Memory Used} $res] \ [regexp {Heap Usage} $res] \ [regexp {Autoindex Inserts} $res] } {1 1 1} | | | 109 110 111 112 113 114 115 116 | SELECT 1; }] list [regexp {Memory Used} $res] \ [regexp {Heap Usage} $res] \ [regexp {Autoindex Inserts} $res] } {1 1 1} finish_test |
Name change from tool/shell5.test to test/shell5.test.
︙ | ︙ | |||
15 16 17 18 19 20 21 | # $Id: shell5.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ # # Test plan: # # shell5-1.*: Basic tests specific to the ".import" command. # | | | | < < | < < | < < < | | < | < < < < | < < | | | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # $Id: shell5.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ # # Test plan: # # shell5-1.*: Basic tests specific to the ".import" command. # set testdir [file dirname $argv0] source $testdir/tester.tcl if {$tcl_platform(platform)=="windows"} { set CLI "sqlite3.exe" } else { set CLI "./sqlite3" } if {![file executable $CLI]} { finish_test return } db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db #---------------------------------------------------------------------------- # Test cases shell5-1.*: Basic handling of the .import and .separator commands. # # .import FILE TABLE Import data from FILE into TABLE do_test shell5-1.1.1 { |
︙ | ︙ | |||
235 236 237 238 239 240 241 | } close $in set res [catchcmd "test.db" {CREATE TABLE t3(a); .import shell5.csv t3 SELECT COUNT(*) FROM t3;}] } [list 0 $rows] | | < | 222 223 224 225 226 227 228 229 | } close $in set res [catchcmd "test.db" {CREATE TABLE t3(a); .import shell5.csv t3 SELECT COUNT(*) FROM t3;}] } [list 0 $rows] finish_test |
Changes to test/tester.tcl.
︙ | ︙ | |||
513 514 515 516 517 518 519 520 521 522 523 524 525 526 | } } else { puts " Omitted" omit_test $name "pattern mismatch" 0 } flush stdout } proc filepath_normalize {p} { # test cases should be written to assume "unix"-like file paths if {$::tcl_platform(platform)!="unix"} { # lreverse*2 as a hack to remove any unneeded {} after the string map lreverse [lreverse [string map {\\ /} [regsub -nocase -all {[a-z]:[/\\]+} $p {/}]]] } { | > > > > > > > > > > | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | } } else { puts " Omitted" omit_test $name "pattern mismatch" 0 } flush stdout } proc catchcmd {db {cmd ""}} { global CLI set out [open cmds.txt w] puts $out $cmd close $out set line "exec $CLI $db < cmds.txt" set rc [catch { eval $line } msg] list $rc $msg } proc filepath_normalize {p} { # test cases should be written to assume "unix"-like file paths if {$::tcl_platform(platform)!="unix"} { # lreverse*2 as a hack to remove any unneeded {} after the string map lreverse [lreverse [string map {\\ /} [regsub -nocase -all {[a-z]:[/\\]+} $p {/}]]] } { |
︙ | ︙ |