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

     1  # 2014 August 30
     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  #
    13  
    14  source [file join [file dirname [info script]] rbu_common.tcl]
    15  set ::testprefix rbuB
    16  
    17  db close
    18  sqlite3_shutdown
    19  test_sqlite3_log xLog
    20  reset_db
    21  
    22  proc xLog {args} { }
    23  
    24  set db_sql {
    25    CREATE TABLE t1(a PRIMARY KEY, b, c);
    26  }
    27  set rbu_sql {
    28    CREATE TABLE data_t1(a, b, c, rbu_control);
    29    INSERT INTO data_t1 VALUES(1, 2, 3, 0);
    30    INSERT INTO data_t1 VALUES(4, 5, 6, 0);
    31    INSERT INTO data_t1 VALUES(7, 8, 9, 0);
    32  }
    33  
    34  do_test 1.1 {
    35    forcedelete rbu.db
    36    sqlite3 rbu rbu.db
    37    rbu eval $rbu_sql
    38    rbu close
    39  
    40    db eval $db_sql
    41  } {}
    42  
    43  set ::errlog [list]
    44  proc xLog {err msg} { lappend ::errlog $err }
    45  do_test 1.2 {
    46    run_rbu test.db rbu.db
    47  } {SQLITE_DONE}
    48  
    49  do_test 1.3 {
    50    set ::errlog
    51  } {SQLITE_NOTICE_RECOVER_WAL SQLITE_INTERNAL}
    52  
    53  do_execsql_test 1.4 {
    54    SELECT * FROM t1
    55  } {1 2 3 4 5 6 7 8 9}
    56  
    57  db close
    58  sqlite3_shutdown
    59  test_sqlite3_log 
    60  sqlite3_initialize
    61  finish_test
    62