xref: /sqlite-3.40.0/ext/session/sessionwor.test (revision e89feee5)
1# 2017 Jan 31
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#
12# The focus of this file is testing the session module. Specifically,
13# testing support for WITHOUT ROWID tables.
14#
15
16if {![info exists testdir]} {
17  set testdir [file join [file dirname [info script]] .. .. test]
18}
19source [file join [file dirname [info script]] session_common.tcl]
20source $testdir/tester.tcl
21ifcapable !session {finish_test; return}
22
23set testprefix sessionwor
24
25proc test_reset {} {
26  catch { db close }
27  catch { db2 close }
28  forcedelete test.db test.db2
29  sqlite3 db test.db
30  sqlite3 db2 test.db2
31}
32
33
34do_execsql_test 1.0 {
35  CREATE TABLE t1(a PRIMARY KEY, b) WITHOUT ROWID;
36}
37
38do_iterator_test 1.1 t1 {
39  INSERT INTO t1 VALUES('one', 'two');
40} {
41  {INSERT t1 0 X. {} {t one t two}}
42}
43
44do_iterator_test 1.2 t1 {
45  UPDATE t1 SET b='three'
46} {
47  {UPDATE t1 0 X. {t one t two} {{} {} t three}}
48}
49
50do_iterator_test 1.3 t1 {
51  DELETE FROM t1;
52} {
53  {DELETE t1 0 X. {t one t three} {}}
54}
55
56finish_test
57