modernc.org/cc@v1.0.1/v2/testdata/_sqlite/ext/session/sessionwor.test (about)

     1  # 2017 Jan 31
     2  #
     3  # The author disclaims copyright to this source code.  In place of
     4  # a legal notice, here is a blessing:
     5  #
     6  #    May you do good and not evil.
     7  #    May you find forgiveness for yourself and forgive others.
     8  #    May you share freely, never taking more than you give.
     9  #
    10  #***********************************************************************
    11  #
    12  # The focus of this file is testing the session module. Specifically,
    13  # testing support for WITHOUT ROWID tables.
    14  #
    15  
    16  if {![info exists testdir]} {
    17    set testdir [file join [file dirname [info script]] .. .. test]
    18  } 
    19  source [file join [file dirname [info script]] session_common.tcl]
    20  source $testdir/tester.tcl
    21  ifcapable !session {finish_test; return}
    22  
    23  set testprefix sessionwor
    24  
    25  proc test_reset {} {
    26    catch { db close }
    27    catch { db2 close }
    28    forcedelete test.db test.db2
    29    sqlite3 db test.db
    30    sqlite3 db2 test.db2
    31  }
    32  
    33  
    34  do_execsql_test 1.0 {
    35    CREATE TABLE t1(a PRIMARY KEY, b) WITHOUT ROWID;
    36  }
    37  
    38  do_iterator_test 1.1 t1 {
    39    INSERT INTO t1 VALUES('one', 'two');
    40  } {
    41    {INSERT t1 0 X. {} {t one t two}}
    42  }
    43  
    44  do_iterator_test 1.2 t1 {
    45    UPDATE t1 SET b='three'
    46  } {
    47    {UPDATE t1 0 X. {t one t two} {{} {} t three}}
    48  }
    49  
    50  do_iterator_test 1.3 t1 {
    51    DELETE FROM t1;
    52  } {
    53    {DELETE t1 0 X. {t one t three} {}}
    54  }
    55  
    56  finish_test
    57