| OLD | NEW |
| 1 # 2010 August 4 | 1 # 2010 August 4 |
| 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 # These tests are specific to the .import command. | 13 # These tests are specific to the .import command. |
| 14 # | 14 # |
| 15 # $Id: shell5.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ | 15 # $Id: shell5.test,v 1.7 2009/07/17 16:54:48 shaneh Exp $ |
| 16 # | 16 # |
| 17 | 17 |
| 18 # Test plan: | 18 # Test plan: |
| 19 # | 19 # |
| 20 # shell5-1.*: Basic tests specific to the ".import" command. | 20 # shell5-1.*: Basic tests specific to the ".import" command. |
| 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 | 27 |
| 36 #---------------------------------------------------------------------------- | 28 #---------------------------------------------------------------------------- |
| 37 # Test cases shell5-1.*: Basic handling of the .import and .separator commands. | 29 # Test cases shell5-1.*: Basic handling of the .import and .separator commands. |
| 38 # | 30 # |
| 39 | 31 |
| 40 # .import FILE TABLE Import data from FILE into TABLE | 32 # .import FILE TABLE Import data from FILE into TABLE |
| 41 do_test shell5-1.1.1 { | 33 do_test shell5-1.1.1 { |
| 42 catchcmd "test.db" ".import" | 34 catchcmd "test.db" ".import" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 close $fd | 421 close $fd |
| 430 catchcmd test.db [string trim { | 422 catchcmd test.db [string trim { |
| 431 .mode csv | 423 .mode csv |
| 432 CREATE TABLE t7(a, b, c); | 424 CREATE TABLE t7(a, b, c); |
| 433 .import shell5.csv t7 | 425 .import shell5.csv t7 |
| 434 }] | 426 }] |
| 435 db eval { SELECT * FROM t7 ORDER BY a } | 427 db eval { SELECT * FROM t7 ORDER BY a } |
| 436 } {1 2 3 4 5 {} 6 7 8} | 428 } {1 2 3 4 5 {} 6 7 8} |
| 437 | 429 |
| 438 finish_test | 430 finish_test |
| OLD | NEW |