/ Check-in [5767850c]
Login

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

Overview
Comment:Test coverage improvements on tokenize.c. (CVS 2196)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5767850ccadb3b53d14bca547e50f65de1d3092e
User & Date: drh 2005-01-11 17:46:42
Context
2005-01-11
17:59
Allow '$' in the middle of identifiers. Ticket #1066. This is an experimental change. It might be backed out at a later date. (CVS 2197) check-in: 00a352ea user: drh tags: trunk
17:46
Test coverage improvements on tokenize.c. (CVS 2196) check-in: 5767850c user: drh tags: trunk
16:54
Improved test coverage for vdbeaux.c. (CVS 2195) check-in: 3f46cd77 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/bind.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 script testing the sqlite_bind API.
    13     13   #
    14         -# $Id: bind.test,v 1.24 2005/01/11 16:54:15 drh Exp $
           14  +# $Id: bind.test,v 1.25 2005/01/11 17:46:42 drh Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   proc sqlite_step {stmt N VALS COLS} {
    21     21     upvar VALS vals
................................................................................
   100    100   # the $var processing is compiled into the library.
   101    101   #
   102    102   ifcapable {tclvar} {
   103    103     do_test bind-2.1 {
   104    104       execsql {
   105    105         DELETE FROM t1;
   106    106       }
   107         -    set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x})} -1 TX]
          107  +    set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES($one,$::two,${x{y}z})}\
          108  +            -1 TX]
   108    109       set TX
   109    110     } {}
   110    111     set v1 {$one}
   111    112     set v2 {$::two}
   112         -  set v3 {${x}}
          113  +  set v3 {${x{y}z}}
   113    114   }
   114    115   ifcapable {!tclvar} {
   115    116     do_test bind-2.1 {
   116    117       execsql {
   117    118         DELETE FROM t1;
   118    119       }
   119    120       set VM [sqlite3_prepare $DB {INSERT INTO t1 VALUES(:one,:two,:_)} -1 TX]
................................................................................
   486    487   do_test bind-10.16 {
   487    488     sqlite3_bind_parameter_name $VM 4
   488    489   } {?4}
   489    490   do_test bind-10.16 {
   490    491     sqlite3_bind_parameter_name $VM 5
   491    492   } :pqr
   492    493   catch {sqlite3_finalize $VM}
          494  +
          495  +# Make sure we catch an unterminated "(" in a Tcl-style variable name
          496  +#
          497  +do_test bind-11.1 {
          498  +  catchsql {SELECT * FROM sqlite_master WHERE name=$abc(123 and sql NOT NULL;}
          499  +} {1 {unrecognized token: "$abc(123"}}
          500  +
   493    501   
   494    502   finish_test

Changes to test/expr.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 expressions.
    13     13   #
    14         -# $Id: expr.test,v 1.40 2004/11/17 16:41:29 danielk1977 Exp $
           14  +# $Id: expr.test,v 1.41 2005/01/11 17:46:42 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Create a table to work with.
    20     20   #
    21     21   execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)}
................................................................................
   538    538       execsql {SELECT CURRENT_DATE==date('now');}
   539    539     } 1
   540    540     do_test expr-8.6 {
   541    541       execsql {SELECT CURRENT_TIMESTAMP==datetime('now');}
   542    542     } 1
   543    543   }
   544    544   set sqlite_current_time 0
          545  +
          546  +do_test expr-9.1 {
          547  +  execsql {SELECT round(-('-'||'123'))}
          548  +} 123
   545    549   
   546    550   finish_test

Changes to test/interrupt.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 script is the sqlite_interrupt() API.
    13     13   #
    14         -# $Id: interrupt.test,v 1.9 2005/01/11 16:54:15 drh Exp $
           14  +# $Id: interrupt.test,v 1.10 2005/01/11 17:46:42 drh Exp $
    15     15   
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   db close
    20     20   set DB [sqlite3 db test.db]
    21     21   
................................................................................
   171    171   set max_count [expr {1000000-$sqlite_interrupt_count}]
   172    172   for {set i 1} {$i<$max_count-5} {incr i 1} {
   173    173     do_test interrupt-4.$i.1 {
   174    174       set ::sqlite_interrupt_count $::i
   175    175       catchsql $sql
   176    176     } {1 interrupted}
   177    177   }
          178  +
          179  +# Interrupt during parsing
          180  +#
          181  +do_test interrupt-5.1 {
          182  +  proc fake_interrupt {args} {sqlite3_interrupt $::DB; return SQLITE_OK}
          183  +  db collation_needed fake_interrupt
          184  +  catchsql {
          185  +    CREATE INDEX fake ON fake1(a COLLATE fake_collation, b, c DESC);
          186  +  }
          187  +} {1 interrupt}
   178    188   
   179    189   finish_test

Changes to test/main.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 exercising the code in main.c.
    13     13   #
    14         -# $Id: main.test,v 1.18 2004/11/04 04:42:28 drh Exp $
           14  +# $Id: main.test,v 1.19 2005/01/11 17:46:42 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Tests of the sqlite_complete() function.
    20     20   #
    21     21   do_test main-1.1 {
................................................................................
    64     64     db complete {DROP TABLE xyz; -- hi
    65     65     }
    66     66   } {1}
    67     67   do_test main-1.14 {
    68     68     db complete {SELECT a-b FROM t1; }
    69     69   } {1}
    70     70   do_test main-1.15 {
    71         -  db complete {SELECT a-b FROM t1 }
           71  +  db complete {SELECT a/e FROM t1 }
    72     72   } {0}
    73     73   do_test main-1.16 {
    74     74     db complete {
    75     75       CREATE TABLE abc(x,y);
    76     76     }
    77     77   } {1}
    78     78   ifcapable {trigger} {
................................................................................
   175    175           CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
   176    176              UPDATE pqr SET a=5;
   177    177         }
   178    178       } {0}
   179    179     }
   180    180     do_test main-1.28 {
   181    181       db complete {
   182         -      CREATE TEMP TRIGGER xyz AFTER DELETE backend BEGIN
          182  +      CREATE TEMPORARY TRIGGER xyz AFTER DELETE backend BEGIN
   183    183            UPDATE pqr SET a=5;
   184    184       }
   185    185     } {0}
   186    186     do_test main-1.29 {
   187    187       db complete {
   188    188         CREATE TRIGGER xyz AFTER DELETE backend BEGIN
   189    189            UPDATE pqr SET a=5;
................................................................................
   273    273   
   274    274   do_test main-3.3 {
   275    275     catch {db close}
   276    276     foreach f [glob -nocomplain testdb/*] {file delete -force $f}
   277    277     file delete -force testdb
   278    278     sqlite3 db testdb
   279    279     execsql {
   280         -    create table T1(X REAL);
          280  +    create table T1(X REAL);  /* C-style comments allowed */
   281    281       insert into T1 values(0.5);
   282    282       insert into T1 values(0.5e2);
   283    283       insert into T1 values(0.5e-002);
   284    284       insert into T1 values(5e-002);
   285    285       insert into T1 values(-5.0e-2);
   286    286       insert into T1 values(-5.1e-2);
   287    287       insert into T1 values(0.5e2);