OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
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 # This file implements regression tests for TCL interface to the | 11 # This file implements regression tests for TCL interface to the |
12 # SQLite library. | 12 # SQLite library. |
13 # | 13 # |
14 # Actually, all tests are based on the TCL interface, so the main | 14 # Actually, all tests are based on the TCL interface, so the main |
15 # interface is pretty well tested. This file contains some addition | 15 # interface is pretty well tested. This file contains some addition |
16 # tests for fringe issues that the main test suite does not cover. | 16 # tests for fringe issues that the main test suite does not cover. |
17 # | 17 # |
18 # $Id: tclsqlite.test,v 1.73 2009/03/16 13:19:36 danielk1977 Exp $ | 18 # $Id: tclsqlite.test,v 1.73 2009/03/16 13:19:36 danielk1977 Exp $ |
19 | 19 |
20 set testdir [file dirname $argv0] | 20 set testdir [file dirname $argv0] |
21 source $testdir/tester.tcl | 21 source $testdir/tester.tcl |
22 | 22 |
23 # Check the error messages generated by tclsqlite | 23 # Check the error messages generated by tclsqlite |
24 # | 24 # |
25 if {[sqlite3 -has-codec]} { | 25 if {[sqlite3 -has-codec]} { |
26 set r "sqlite_orig HANDLE FILENAME ?-key CODEC-KEY?" | 26 set r "sqlite_orig HANDLE FILENAME ?-key CODEC-KEY?" |
27 } else { | 27 } else { |
28 set r "sqlite3 HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOO
LEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN?" | 28 set r "sqlite_orig HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create
BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN?" |
29 } | 29 } |
30 do_test tcl-1.1 { | 30 do_test tcl-1.1 { |
31 set v [catch {sqlite3 bogus} msg] | 31 set v [catch {sqlite3 bogus} msg] |
32 regsub {really_sqlite3} $msg {sqlite3} msg | 32 regsub {really_sqlite3} $msg {sqlite3} msg |
33 lappend v $msg | 33 lappend v $msg |
34 } [list 1 "wrong # args: should be \"$r\""] | 34 } [list 1 "wrong # args: should be \"$r\""] |
35 do_test tcl-1.2 { | 35 do_test tcl-1.2 { |
36 set v [catch {db bogus} msg] | 36 set v [catch {db bogus} msg] |
37 lappend v $msg | 37 lappend v $msg |
38 } {1 {bad option "bogus": must be authorizer, backup, busy, cache, changes, clos
e, collate, collation_needed, commit_hook, complete, copy, enable_load_extension
, errorcode, eval, exists, function, incrblob, interrupt, last_insert_rowid, nul
lvalue, onecolumn, profile, progress, rekey, restore, rollback_hook, status, tim
eout, total_changes, trace, transaction, unlock_notify, update_hook, or version}
} | 38 } {1 {bad option "bogus": must be authorizer, backup, busy, cache, changes, clos
e, collate, collation_needed, commit_hook, complete, copy, enable_load_extension
, errorcode, eval, exists, function, incrblob, interrupt, last_insert_rowid, nul
lvalue, onecolumn, profile, progress, rekey, restore, rollback_hook, status, tim
eout, total_changes, trace, transaction, unlock_notify, update_hook, version, or
wal_hook}} |
39 do_test tcl-1.2.1 { | 39 do_test tcl-1.2.1 { |
40 set v [catch {db cache bogus} msg] | 40 set v [catch {db cache bogus} msg] |
41 lappend v $msg | 41 lappend v $msg |
42 } {1 {bad option "bogus": must be flush or size}} | 42 } {1 {bad option "bogus": must be flush or size}} |
43 do_test tcl-1.2.2 { | 43 do_test tcl-1.2.2 { |
44 set v [catch {db cache} msg] | 44 set v [catch {db cache} msg] |
45 lappend v $msg | 45 lappend v $msg |
46 } {1 {wrong # args: should be "db cache option ?arg?"}} | 46 } {1 {wrong # args: should be "db cache option ?arg?"}} |
47 do_test tcl-1.3 { | 47 do_test tcl-1.3 { |
48 execsql {CREATE TABLE t1(a int, b int)} | 48 execsql {CREATE TABLE t1(a int, b int)} |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 do_test tcl-11.1 { | 562 do_test tcl-11.1 { |
563 db eval {INSERT INTO t4 VALUES(6)} | 563 db eval {INSERT INTO t4 VALUES(6)} |
564 db exists {SELECT x,x*2,x+x FROM t4 WHERE x==6} | 564 db exists {SELECT x,x*2,x+x FROM t4 WHERE x==6} |
565 } {1} | 565 } {1} |
566 do_test tcl-11.2 { | 566 do_test tcl-11.2 { |
567 db exists {SELECT 0 FROM t4 WHERE x==6} | 567 db exists {SELECT 0 FROM t4 WHERE x==6} |
568 } {1} | 568 } {1} |
569 do_test tcl-11.3 { | 569 do_test tcl-11.3 { |
570 db exists {SELECT 1 FROM t4 WHERE x==8} | 570 db exists {SELECT 1 FROM t4 WHERE x==8} |
571 } {0} | 571 } {0} |
| 572 do_test tcl-11.3.1 { |
| 573 tcl_objproc db exists {SELECT 1 FROM t4 WHERE x==8} |
| 574 } {0} |
572 | 575 |
573 do_test tcl-12.1 { | 576 do_test tcl-12.1 { |
574 unset -nocomplain a b c version | 577 unset -nocomplain a b c version |
575 set version [db version] | 578 set version [db version] |
576 scan $version "%d.%d.%d" a b c | 579 scan $version "%d.%d.%d" a b c |
577 expr $a*1000000 + $b*1000 + $c | 580 expr $a*1000000 + $b*1000 + $c |
578 } [sqlite3_libversion_number] | 581 } [sqlite3_libversion_number] |
579 | 582 |
580 | 583 |
581 # Check to see that when bindings of the form @aaa are used instead | 584 # Check to see that when bindings of the form @aaa are used instead |
(...skipping 27 matching lines...) Expand all Loading... |
609 db eval { | 612 db eval { |
610 DELETE FROM t5; | 613 DELETE FROM t5; |
611 INSERT INTO t5 VALUES(@y); | 614 INSERT INTO t5 VALUES(@y); |
612 SELECT hex(x), typeof(x) FROM t5 | 615 SELECT hex(x), typeof(x) FROM t5 |
613 } | 616 } |
614 } {31323334 blob} | 617 } {31323334 blob} |
615 } | 618 } |
616 | 619 |
617 | 620 |
618 finish_test | 621 finish_test |
OLD | NEW |