/ Check-in [997d8aff]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved coverage for insert.c. (CVS 2213)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 997d8afff9b316aef4c5e2127c2207758ff4a703
User & Date: drh 2005-01-15 00:36:37
Context
2005-01-15
00:40
Improved test coverage for update.c. (CVS 2214) check-in: 3ef95d5f user: drh tags: trunk
00:36
Improved coverage for insert.c. (CVS 2213) check-in: 997d8aff user: drh tags: trunk
2005-01-14
22:55
Add comments to the new balance_quick() routine. (CVS 2212) check-in: 183c42ea user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/insert3.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing corner cases of the INSERT statement.
    13     13   #
    14         -# $Id: insert3.test,v 1.1 2005/01/14 01:22:01 drh Exp $
           14  +# $Id: insert3.test,v 1.2 2005/01/15 00:36:37 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
           18  +
           19  +# All the tests in this file require trigger support
           20  +#
           21  +ifcapable {trigger} {
    18     22   
    19     23   # Create a table and a corresponding insert trigger.  Do a self-insert
    20     24   # into the table.
    21     25   #
    22     26   do_test insert3-1.0 {
    23     27     execsql {
    24     28       CREATE TABLE t1(a,b);
................................................................................
    89     93       DELETE FROM t2dup;
    90     94       INSERT INTO t2(a) SELECT 1 FROM t1 LIMIT 1;
    91     95       INSERT INTO t2(b) SELECT 987 FROM t1 LIMIT 1;
    92     96       INSERT INTO t2(c) SELECT 876 FROM t1 LIMIT 1;
    93     97       SELECT * FROM t2dup;
    94     98     }
    95     99   } {1 b c -1 987 c -1 b 876}
          100  +
          101  +# Test for proper detection of malformed WHEN clauses on INSERT triggers.
          102  +#
          103  +do_test insert3-3.1 {
          104  +  execsql {
          105  +    CREATE TABLE t3(a,b,c);
          106  +    CREATE TRIGGER t3r1 BEFORE INSERT on t3 WHEN nosuchcol BEGIN
          107  +      SELECT 'illegal WHEN clause';
          108  +    END;
          109  +  }
          110  +} {}
          111  +do_test insert3-3.2 {
          112  +  catchsql {
          113  +    INSERT INTO t3 VALUES(1,2,3)
          114  +  }
          115  +} {1 {no such column: nosuchcol}}
          116  +do_test insert3-3.3 {
          117  +  execsql {
          118  +    CREATE TABLE t4(a,b,c);
          119  +    CREATE TRIGGER t4r1 AFTER INSERT on t4 WHEN nosuchcol BEGIN
          120  +      SELECT 'illegal WHEN clause';
          121  +    END;
          122  +  }
          123  +} {}
          124  +do_test insert3-3.4 {
          125  +  catchsql {
          126  +    INSERT INTO t4 VALUES(1,2,3)
          127  +  }
          128  +} {1 {no such column: nosuchcol}}
          129  +
          130  +} ;# ifcapable {trigger}
    96    131   
    97    132   finish_test