Annotation of embedaddon/sqlite3/test/func3.test, revision 1.1

1.1     ! misho       1: # 2010 August 27
        !             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: # This file implements regression tests for SQLite library. The
        !            12: # focus of this file is testing that destructor functions associated
        !            13: # with functions created using sqlite3_create_function_v2() is 
        !            14: # correctly invoked.
        !            15: #
        !            16: set testdir [file dirname $argv0]
        !            17: source $testdir/tester.tcl
        !            18: 
        !            19: 
        !            20: ifcapable utf16 {
        !            21:   do_test func3-1.1 {
        !            22:     set destroyed 0
        !            23:     proc destroy {} { set ::destroyed 1 }
        !            24:     sqlite3_create_function_v2 db f2 -1 any -func f2 -destroy destroy
        !            25:     set destroyed
        !            26:   } 0
        !            27:   do_test func3-1.2 {
        !            28:     sqlite3_create_function_v2 db f2 -1 utf8 -func f2
        !            29:     set destroyed
        !            30:   } 0
        !            31:   do_test func3-1.3 {
        !            32:     sqlite3_create_function_v2 db f2 -1 utf16le -func f2
        !            33:     set destroyed
        !            34:   } 0
        !            35:   do_test func3-1.4 {
        !            36:     sqlite3_create_function_v2 db f2 -1 utf16be -func f2
        !            37:     set destroyed
        !            38:   } 1
        !            39: }
        !            40: 
        !            41: do_test func3-2.1 {
        !            42:   set destroyed 0
        !            43:   proc destroy {} { set ::destroyed 1 }
        !            44:   sqlite3_create_function_v2 db f3 -1 utf8 -func f3 -destroy destroy
        !            45:   set destroyed
        !            46: } 0
        !            47: do_test func3-2.2 {
        !            48:   sqlite3_create_function_v2 db f3 -1 utf8 -func f3
        !            49:   set destroyed
        !            50: } 1
        !            51: 
        !            52: do_test func3-3.1 {
        !            53:   set destroyed 0
        !            54:   proc destroy {} { set ::destroyed 1 }
        !            55:   sqlite3_create_function_v2 db f3 -1 any -func f3 -destroy destroy
        !            56:   set destroyed
        !            57: } 0
        !            58: do_test func3-3.2 {
        !            59:   db close
        !            60:   set destroyed
        !            61: } 1
        !            62: 
        !            63: sqlite3 db test.db
        !            64: do_test func3-4.1 {
        !            65:   set destroyed 0
        !            66:   set rc [catch { 
        !            67:     sqlite3_create_function_v2 db f3 -1 any -func f3 -step f3 -destroy destroy
        !            68:   } msg]
        !            69:   list $rc $msg
        !            70: } {1 SQLITE_MISUSE}
        !            71: do_test func3-4.2 { set destroyed } 1
        !            72: 
        !            73: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>