d915152677
FossilOrigin-Name: 1085911afb51744f32fe9db183b50e8e88bdd73e
67 lines
1.6 KiB
Plaintext
67 lines
1.6 KiB
Plaintext
# 2016 March 30
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# This file implements regression tests for the sessions module.
|
|
# Specifically, it tests that UNIQUE constraints are dealt with correctly.
|
|
#
|
|
|
|
|
|
|
|
if {![info exists testdir]} {
|
|
set testdir [file join [file dirname [info script]] .. .. test]
|
|
}
|
|
source [file join [file dirname [info script]] session_common.tcl]
|
|
source $testdir/tester.tcl
|
|
ifcapable !session {finish_test; return}
|
|
set testprefix sessionG
|
|
|
|
|
|
forcedelete test.db2
|
|
sqlite3 db2 test.db2
|
|
|
|
do_test 1.0 {
|
|
do_common_sql {
|
|
CREATE TABLE t1(a PRIMARY KEY, b UNIQUE);
|
|
INSERT INTO t1 VALUES(1, 'one');
|
|
INSERT INTO t1 VALUES(2, 'two');
|
|
INSERT INTO t1 VALUES(3, 'three');
|
|
}
|
|
do_then_apply_sql {
|
|
DELETE FROM t1 WHERE a=1;
|
|
INSERT INTO t1 VALUES(4, 'one');
|
|
}
|
|
compare_db db db2
|
|
} {}
|
|
|
|
do_test 1.1 {
|
|
do_then_apply_sql {
|
|
DELETE FROM t1 WHERE a=4;
|
|
INSERT INTO t1 VALUES(1, 'one');
|
|
}
|
|
compare_db db db2
|
|
} {}
|
|
|
|
do_test 1.2 {
|
|
execsql { INSERT INTO t1 VALUES(5, 'five') } db2
|
|
do_then_apply_sql {
|
|
INSERT INTO t1 VALUES(11, 'eleven');
|
|
INSERT INTO t1 VALUES(12, 'five');
|
|
}
|
|
execsql { SELECT * FROM t1 } db2
|
|
} {2 two 3 three 1 one 5 five 11 eleven}
|
|
|
|
do_test 1.3 {
|
|
execsql { SELECT * FROM t1 }
|
|
} {2 two 3 three 1 one 11 eleven 12 five}
|
|
|
|
finish_test
|
|
|