Add a test for the fixes on this branch.
[sqlite.git] / test / savepoint5.test
blobdc5268b3c366062195e1e58d8b62179207312680
1 # 2009 January 2
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # Verify that a SAVEPOINT on a new, empty database followed by a
13 # ROLLBACK TO that savepoint starts over again with another new
14 # empty database.
16 # $Id: savepoint5.test,v 1.1 2009/01/02 21:08:09 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 do_test savepoint5-1.1 {
22   db eval {
23     SAVEPOINT sp1;
24     CREATE TABLE t1(x);
25     INSERT INTO t1 VALUES(1);
26     SELECT count(*) FROM sqlite_master;
27     SELECT * FROM t1;
28   }
29 } {1 1}
30 do_test savepoint5-1.2 {
31   db eval {
32     ROLLBACK TO sp1;
33     SELECT count(*) FROM sqlite_master;
34   }
35 } {0}
36 do_test savepoint5-1.3 {
37   db eval {
38     CREATE TABLE t1(x);
39     INSERT INTO t1 VALUES(1);
40     SELECT count(*) FROM sqlite_master;
41     SELECT * FROM t1;
42   }
43 } {1 1}
46 finish_test