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

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/test/sqllog.test

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 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
(Empty)
1 # 2015 November 13
2 #
3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
5 #
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
9 #
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the test_sqllog.c module.
13 #
14
15 set testdir [file dirname $argv0]
16 source $testdir/tester.tcl
17 set testprefix sqllog
18
19 ifcapable !sqllog {
20 finish_test
21 return
22 }
23
24 proc readfile {f} {
25 set fd [open $f]
26 set txt [read $fd]
27 close $fd
28 set txt
29 }
30
31 proc delete_all_sqllog_files {} {
32 forcedelete {*}[glob -nocomplain sqllog_*.sql]
33 forcedelete {*}[glob -nocomplain sqllog_*.db]
34 forcedelete {*}[glob -nocomplain sqllog_*.idx]
35 }
36
37 proc touch {f} {
38 set fd [open $f w+]
39 close $fd
40 }
41
42 db close
43 sqlite3_shutdown
44 set ::env(SQLITE_SQLLOG_DIR) [pwd]
45
46 delete_all_sqllog_files
47
48 sqlite3 db test.db
49 set a a
50 set b b
51 do_execsql_test 1.0 {
52 CREATE TABLE t1(x, y);
53 INSERT INTO t1 VALUES(1, 2);
54 INSERT INTO t1 VALUES($a, $b);
55 SELECT * FROM t1;
56 } {1 2 a b}
57 db close
58
59 do_test 1.1 {
60 readfile [lindex [glob sqllog_*.sql] 0]
61 } [string trimleft {
62 /-- Main database is '.*/sqllog_.*_0.db'
63 CREATE TABLE t1\(x, y\);; -- clock=0
64 INSERT INTO t1 VALUES\(1, 2\);; -- clock=1
65 INSERT INTO t1 VALUES\('a', 'b'\);; -- clock=2
66 SELECT . FROM t1;; -- clock=3
67 /}]
68
69 do_test 1.2 {
70 file size [lindex [glob sqllog_*_0.db] 0]
71 } 1024
72
73 #-------------------------------------------------------------------------
74 catch { db close }
75 sqlite3_shutdown
76 delete_all_sqllog_files
77 forcedelete test.db-sqllog
78
79 set ::env(SQLITE_SQLLOG_CONDITIONAL) 1
80 sqlite3 db test.db
81 do_execsql_test 2.1 {
82 INSERT INTO t1 VALUES(4, 5);
83 SELECT * FROM t1;
84 } {1 2 a b 4 5}
85
86 do_test 2.2 {
87 glob -nocomplain sqllog_*
88 } {}
89
90 db close
91 touch test.db-sqllog
92 sqlite3 db test.db
93 do_execsql_test 2.3 {
94 INSERT INTO t1 VALUES(6, 7);
95 SELECT * FROM t1;
96 } {1 2 a b 4 5 6 7}
97 db close
98
99 do_test 2.4 {
100 readfile [lindex [glob sqllog_*.sql] 0]
101 } [string trimleft {
102 /-- Main database is '.*/sqllog_.*_0.db'
103 INSERT INTO t1 VALUES\(6, 7\);; -- clock=0
104 SELECT . FROM t1;; -- clock=1
105 /}]
106
107 catch { db close }
108 sqlite3_shutdown
109 unset ::env(SQLITE_SQLLOG_DIR)
110 unset ::env(SQLITE_SQLLOG_CONDITIONAL)
111 sqlite3_config_sqllog
112 sqlite3_initialize
113 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/test/sqllimits1.test ('k') | third_party/sqlite/sqlite-src-3170000/test/stat.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698