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

Side by Side Diff: third_party/sqlite/src/test/journal1.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 # 2005 March 15 1 # 2005 March 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 SQLite library. 11 # This file implements regression tests for SQLite library.
12 # 12 #
13 # This file implements tests to make sure that leftover journals from 13 # This file implements tests to make sure that leftover journals from
14 # prior databases do not try to rollback into new databases. 14 # prior databases do not try to rollback into new databases.
15 # 15 #
16 # $Id: journal1.test,v 1.2 2005/03/20 22:54:56 drh Exp $ 16 # $Id: journal1.test,v 1.2 2005/03/20 22:54:56 drh Exp $
17 17
18 18
19 set testdir [file dirname $argv0] 19 set testdir [file dirname $argv0]
20 source $testdir/tester.tcl 20 source $testdir/tester.tcl
21 21
22 # These tests will not work on windows because windows uses 22 # These tests will not work on windows because windows uses
23 # manditory file locking which breaks the file copy command. 23 # manditory file locking which breaks the copy_file command.
24 # 24 #
25 if {$tcl_platform(platform)=="windows"} { 25 if {$tcl_platform(platform)=="windows"} {
26 finish_test 26 finish_test
27 return 27 return
28 } 28 }
29 29
30 # Create a smaple database 30 # Create a smaple database
31 # 31 #
32 do_test journal1-1.1 { 32 do_test journal1-1.1 {
33 execsql { 33 execsql {
34 CREATE TABLE t1(a,b); 34 CREATE TABLE t1(a,b);
35 INSERT INTO t1 VALUES(1,randstr(10,400)); 35 INSERT INTO t1 VALUES(1,randstr(10,400));
36 INSERT INTO t1 VALUES(2,randstr(10,400)); 36 INSERT INTO t1 VALUES(2,randstr(10,400));
37 INSERT INTO t1 SELECT a+2, a||b FROM t1; 37 INSERT INTO t1 SELECT a+2, a||b FROM t1;
38 INSERT INTO t1 SELECT a+4, a||b FROM t1; 38 INSERT INTO t1 SELECT a+4, a||b FROM t1;
39 SELECT count(*) FROM t1; 39 SELECT count(*) FROM t1;
40 } 40 }
41 } 8 41 } 8
42 42
43 # Make changes to the database and save the journal file. 43 # Make changes to the database and save the journal file.
44 # Then delete the database. Replace the the journal file 44 # Then delete the database. Replace the journal file
45 # and try to create a new database with the same name. The 45 # and try to create a new database with the same name. The
46 # old journal should not attempt to rollback into the new 46 # old journal should not attempt to rollback into the new
47 # database. 47 # database.
48 # 48 #
49 do_test journal1-1.2 { 49 do_test journal1-1.2 {
50 execsql { 50 execsql {
51 BEGIN; 51 BEGIN;
52 DELETE FROM t1; 52 DELETE FROM t1;
53 } 53 }
54 file copy -force test.db-journal test.db-journal-bu 54 forcecopy test.db-journal test.db-journal-bu
55 execsql { 55 execsql {
56 ROLLBACK; 56 ROLLBACK;
57 } 57 }
58 db close 58 db close
59 file delete test.db 59 delete_file test.db
60 file copy test.db-journal-bu test.db-journal 60 copy_file test.db-journal-bu test.db-journal
61 sqlite3 db test.db 61 sqlite3 db test.db
62 catchsql { 62 catchsql {
63 SELECT * FROM sqlite_master 63 SELECT * FROM sqlite_master
64 } 64 }
65 } {0 {}} 65 } {0 {}}
66 66
67 finish_test 67 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698