sqlite/test/existsfault.test
dan f7588d4072 Add OOM injection tests for new code on this branch.
FossilOrigin-Name: 9a181dbaedcc2117e670e679ca94ed6d1fabd90c835671dee36424dd0646c4e5
2021-01-15 17:51:56 +00:00

53 lines
1.4 KiB
Plaintext

# 2021 January 15
#
# 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 SQLite library. The
# focus of this file is testing cases where EXISTS expressions are
# transformed to IN() expressions by where.c
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix existsfault
do_execsql_test 1 {
CREATE TABLE t1(a PRIMARY KEY, b);
INSERT INTO t1 VALUES(1, 'one');
INSERT INTO t1 VALUES(2, 'two');
INSERT INTO t1 VALUES(3, 'three');
INSERT INTO t1 VALUES(4, 'four');
INSERT INTO t1 VALUES(5, 'five');
INSERT INTO t1 VALUES(6, 'six');
INSERT INTO t1 VALUES(7, 'seven');
CREATE TABLE t2(c INTEGER, d INTEGER);
INSERT INTO t2 VALUES(1, 1);
INSERT INTO t2 VALUES(3, 2);
INSERT INTO t2 VALUES(5, 3);
INSERT INTO t2 VALUES(7, 4);
}
faultsim_save_and_close
do_faultsim_test 1 -prep {
faultsim_restore_and_reopen
} -body {
execsql {
SELECT t1.* FROM t1 WHERE EXISTS(
SELECT * FROM t2 WHERE t2.c=t1.a AND d IN (1, 2, 3)
)
}
} -test {
faultsim_test_result {0 {1 one 3 three 5 five}}
}
finish_test