1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2817.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,72 @@
1.4 +# 2007 December 02
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +# This file implements regression tests for SQLite library.
1.15 +#
1.16 +# Specifically, it tests that bug 2817 is fixed.
1.17 +#
1.18 +# $Id: tkt2817.test,v 1.2 2008/07/12 14:52:21 drh Exp $
1.19 +
1.20 +set testdir [file dirname $argv0]
1.21 +source $testdir/tester.tcl
1.22 +
1.23 +do_test tkt2817-1.0 {
1.24 + execsql {
1.25 + CREATE TEMP TABLE tbl(a, b, c);
1.26 + -- INSERT INTO tbl VALUES(1, 'abc', 'def');
1.27 + -- INSERT INTO tbl VALUES(2, 'ghi', 'jkl');
1.28 + }
1.29 +} {}
1.30 +do_test tkt2817-1.1 {
1.31 + execsql {
1.32 + CREATE TABLE main.tbl(a, b, c);
1.33 + CREATE INDEX main.tbli ON tbl(a, b, c);
1.34 + INSERT INTO main.tbl SELECT a, b, c FROM temp.tbl;
1.35 + }
1.36 +} {}
1.37 +
1.38 +# When bug #2817 existed, this test was failing.
1.39 +#
1.40 +integrity_check tkt2817-1.2
1.41 +
1.42 +# So was this one.
1.43 +#
1.44 +db close
1.45 +sqlite3 db test.db
1.46 +integrity_check tkt2817-1.3
1.47 +
1.48 +
1.49 +# These tests - tkt2817-2.* - are the same as the previous block, except
1.50 +# for the fact that the temp-table and the main table do not share the
1.51 +# same name. #2817 did not cause a problem with these tests.
1.52 +#
1.53 +db close
1.54 +file delete -force test.db
1.55 +sqlite3 db test.db
1.56 +do_test tkt2817-2.0 {
1.57 + execsql {
1.58 + CREATE TEMP TABLE tmp(a, b, c);
1.59 + INSERT INTO tmp VALUES(1, 'abc', 'def');
1.60 + INSERT INTO tmp VALUES(2, 'ghi', 'jkl');
1.61 + }
1.62 +} {}
1.63 +do_test tkt2817-2.1 {
1.64 + execsql {
1.65 + CREATE TABLE main.tbl(a, b, c);
1.66 + CREATE INDEX main.tbli ON tbl(a, b, c);
1.67 + INSERT INTO main.tbl SELECT a, b, c FROM temp.tmp;
1.68 + }
1.69 +} {}
1.70 +integrity_check tkt2817-2.2
1.71 +db close
1.72 +sqlite3 db test.db
1.73 +integrity_check tkt2817-2.3
1.74 +
1.75 +finish_test