xref: /sqlite-3.40.0/test/insertfault.test (revision c2ea77e5)
1*c2ea77e5Sdan# 2019-01-26
2*c2ea77e5Sdan#
3*c2ea77e5Sdan# The author disclaims copyright to this source code.  In place of
4*c2ea77e5Sdan# a legal notice, here is a blessing:
5*c2ea77e5Sdan#
6*c2ea77e5Sdan#    May you do good and not evil.
7*c2ea77e5Sdan#    May you find forgiveness for yourself and forgive others.
8*c2ea77e5Sdan#    May you share freely, never taking more than you give.
9*c2ea77e5Sdan#
10*c2ea77e5Sdan#***********************************************************************
11*c2ea77e5Sdan#
12*c2ea77e5Sdan# Test cases for INSERT
13*c2ea77e5Sdan
14*c2ea77e5Sdanset testdir [file dirname $argv0]
15*c2ea77e5Sdansource $testdir/tester.tcl
16*c2ea77e5Sdanset testprefix insertfault
17*c2ea77e5Sdan
18*c2ea77e5Sdando_execsql_test 1.0 {
19*c2ea77e5Sdan  CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, d DEFAULT true);
20*c2ea77e5Sdan  INSERT INTO t1 DEFAULT VALUES;
21*c2ea77e5Sdan  SELECT * FROM t1;
22*c2ea77e5Sdan} {1 {} {} 1}
23*c2ea77e5Sdanfaultsim_save_and_close
24*c2ea77e5Sdan
25*c2ea77e5Sdanbreakpoint
26*c2ea77e5Sdando_faultsim_test 1 -faults oom* -prep {
27*c2ea77e5Sdan  faultsim_restore_and_reopen
28*c2ea77e5Sdan  db eval { SELECT * FROM sqlite_master }
29*c2ea77e5Sdan} -body {
30*c2ea77e5Sdan  execsql { SELECT * FROM t1 }
31*c2ea77e5Sdan} -test {
32*c2ea77e5Sdan  faultsim_test_result {0 {1 {} {} 1}}
33*c2ea77e5Sdan}
34*c2ea77e5Sdan
35*c2ea77e5Sdan
36*c2ea77e5Sdanfinish_test
37