Additional test cases added on the sqlite3_create_function() interface. (CVS 5349)
FossilOrigin-Name: 4e941f3d43556d8a503bb96e8a74451de36d243e
This commit is contained in:
+50
-1
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing built-in functions.
|
||||
#
|
||||
# $Id: func.test,v 1.80 2008/06/19 18:39:11 drh Exp $
|
||||
# $Id: func.test,v 1.81 2008/07/07 14:50:14 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -952,4 +952,53 @@ do_test func-25.1 {
|
||||
execsql {SELECT test_isolation(t1,t1) FROM tbl1}
|
||||
} {this program is free software}
|
||||
|
||||
# Try to misuse the sqlite3_create_function() interface. Verify that
|
||||
# errors are returned.
|
||||
#
|
||||
do_test func-26.1 {
|
||||
abuse_create_function db
|
||||
} {}
|
||||
|
||||
# The previous test (func-26.1) registered a function with a very long
|
||||
# function name that takes many arguments and always returns NULL. Verify
|
||||
# that this function works correctly.
|
||||
#
|
||||
do_test func-26.2 {
|
||||
set a {}
|
||||
for {set i 1} {$i<=$::SQLITE_MAX_FUNCTION_ARG} {incr i} {
|
||||
lappend a $i
|
||||
}
|
||||
db eval "
|
||||
SELECT nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789([join $a ,]);
|
||||
"
|
||||
} {{}}
|
||||
do_test func-26.3 {
|
||||
set a {}
|
||||
for {set i 1} {$i<=$::SQLITE_MAX_FUNCTION_ARG+1} {incr i} {
|
||||
lappend a $i
|
||||
}
|
||||
catchsql "
|
||||
SELECT nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789([join $a ,]);
|
||||
"
|
||||
} {1 {too many arguments on function nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789}}
|
||||
do_test func-26.4 {
|
||||
set a {}
|
||||
for {set i 1} {$i<=$::SQLITE_MAX_FUNCTION_ARG-1} {incr i} {
|
||||
lappend a $i
|
||||
}
|
||||
catchsql "
|
||||
SELECT nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789([join $a ,]);
|
||||
"
|
||||
} {1 {wrong number of arguments to function nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789()}}
|
||||
do_test func-26.5 {
|
||||
catchsql "
|
||||
SELECT nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678a(0);
|
||||
"
|
||||
} {1 {no such function: nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678a}}
|
||||
do_test func-26.6 {
|
||||
catchsql "
|
||||
SELECT nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789a(0);
|
||||
"
|
||||
} {1 {no such function: nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789a}}
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user