Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: third_party/sqlite/src/test/tclsqlite.test

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "sqlite_orig HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN?" 28 set r "sqlite_orig HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? ?-uri 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, version, or wal_hook}} 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}}
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 lappend v $msg 136 lappend v $msg
137 } {1 {wrong # args: should be "db collate NAME SCRIPT"}} 137 } {1 {wrong # args: should be "db collate NAME SCRIPT"}}
138 do_test tcl-1.20 { 138 do_test tcl-1.20 {
139 set v [catch {db collation_needed} msg] 139 set v [catch {db collation_needed} msg]
140 lappend v $msg 140 lappend v $msg
141 } {1 {wrong # args: should be "db collation_needed SCRIPT"}} 141 } {1 {wrong # args: should be "db collation_needed SCRIPT"}}
142 do_test tcl-1.21 { 142 do_test tcl-1.21 {
143 set v [catch {db total_changes xyz} msg] 143 set v [catch {db total_changes xyz} msg]
144 lappend v $msg 144 lappend v $msg
145 } {1 {wrong # args: should be "db total_changes "}} 145 } {1 {wrong # args: should be "db total_changes "}}
146 do_test tcl-1.20 { 146 do_test tcl-1.22 {
147 set v [catch {db copy} msg] 147 set v [catch {db copy} msg]
148 lappend v $msg 148 lappend v $msg
149 } {1 {wrong # args: should be "db copy CONFLICT-ALGORITHM TABLE FILENAME ?SEPARA TOR? ?NULLINDICATOR?"}} 149 } {1 {wrong # args: should be "db copy CONFLICT-ALGORITHM TABLE FILENAME ?SEPARA TOR? ?NULLINDICATOR?"}}
150 do_test tcl-1.21 { 150 do_test tcl-1.23 {
151 set v [catch {sqlite3 db2 test.db -vfs nosuchvfs} msg] 151 set v [catch {sqlite3 db2 test.db -vfs nosuchvfs} msg]
152 lappend v $msg 152 lappend v $msg
153 } {1 {no such vfs: nosuchvfs}} 153 } {1 {no such vfs: nosuchvfs}}
154 154
155 catch {unset ::result} 155 catch {unset ::result}
156 do_test tcl-2.1 { 156 do_test tcl-2.1 {
157 execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)" 157 execsql "CREATE TABLE t\u0123x(a int, b\u1235 float)"
158 } {} 158 } {}
159 ifcapable schema_pragmas { 159 ifcapable schema_pragmas {
160 do_test tcl-2.2 { 160 do_test tcl-2.2 {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 expr 0 312 expr 0
313 } {0} 313 } {0}
314 314
315 # modify and reset the NULL representation 315 # modify and reset the NULL representation
316 # 316 #
317 do_test tcl-8.1 { 317 do_test tcl-8.1 {
318 db nullvalue NaN 318 db nullvalue NaN
319 execsql {INSERT INTO t1 VALUES(30,NULL)} 319 execsql {INSERT INTO t1 VALUES(30,NULL)}
320 db eval {SELECT * FROM t1 WHERE b IS NULL} 320 db eval {SELECT * FROM t1 WHERE b IS NULL}
321 } {30 NaN} 321 } {30 NaN}
322 proc concatFunc args {return [join $args {}]}
322 do_test tcl-8.2 { 323 do_test tcl-8.2 {
324 db function concat concatFunc
325 db eval {SELECT concat('a', b, 'z') FROM t1 WHERE b is NULL}
326 } {aNaNz}
327 do_test tcl-8.3 {
323 db nullvalue NULL 328 db nullvalue NULL
324 db nullvalue 329 db nullvalue
325 } {NULL} 330 } {NULL}
326 do_test tcl-8.3 { 331 do_test tcl-8.4 {
327 db nullvalue {} 332 db nullvalue {}
328 db eval {SELECT * FROM t1 WHERE b IS NULL} 333 db eval {SELECT * FROM t1 WHERE b IS NULL}
329 } {30 {}} 334 } {30 {}}
335 do_test tcl-8.5 {
336 db function concat concatFunc
337 db eval {SELECT concat('a', b, 'z') FROM t1 WHERE b is NULL}
338 } {az}
330 339
331 # Test the return type of user-defined functions 340 # Test the return type of user-defined functions
332 # 341 #
333 do_test tcl-9.1 { 342 do_test tcl-9.1 {
334 db function ret_str {return "hi"} 343 db function ret_str {return "hi"}
335 execsql {SELECT typeof(ret_str())} 344 execsql {SELECT typeof(ret_str())}
336 } {text} 345 } {text}
337 do_test tcl-9.2 { 346 do_test tcl-9.2 {
338 db function ret_dbl {return [expr {rand()*0.5}]} 347 db function ret_dbl {return [expr {rand()*0.5}]}
339 execsql {SELECT typeof(ret_dbl())} 348 execsql {SELECT typeof(ret_dbl())}
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 do_test tcl-13.4 { 619 do_test tcl-13.4 {
611 set y 1234 620 set y 1234
612 db eval { 621 db eval {
613 DELETE FROM t5; 622 DELETE FROM t5;
614 INSERT INTO t5 VALUES(@y); 623 INSERT INTO t5 VALUES(@y);
615 SELECT hex(x), typeof(x) FROM t5 624 SELECT hex(x), typeof(x) FROM t5
616 } 625 }
617 } {31323334 blob} 626 } {31323334 blob}
618 } 627 }
619 628
629 db func xCall xCall
630 proc xCall {} { return "value" }
631 do_execsql_test tcl-14.1 {
632 CREATE TABLE t6(x);
633 INSERT INTO t6 VALUES(1);
634 }
635 do_test tcl-14.2 {
636 db one {SELECT x FROM t6 WHERE xCall()!='value'}
637 } {}
638
639
620 640
621 finish_test 641 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698