1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-22 00:02:13 +03:00
Files
sqlite/test/func9.test
drh 23e59b34e9 Fix the concat_ws() SQL function so that it includes empty strings in the
concatenation.  [forum:/forumpost/52503ac21d|Forum post 52503ac21d].

FossilOrigin-Name: 80a78987da484d435a8242c05c48d546d430920df713b24a9d9d9fff7ba1113d
2025-06-11 00:01:42 +00:00

54 lines
1.5 KiB
Plaintext

# 2023-08-29
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
#
# Test cases for some newer SQL functions
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_execsql_test func9-100 {
SELECT concat('abc',123,null,'xyz');
} {abc123xyz}
do_execsql_test func9-110 {
SELECT typeof(concat(null));
} {text}
do_catchsql_test func9-120 {
SELECT concat();
} {1 {wrong number of arguments to function concat()}}
do_execsql_test func9-130 {
SELECT concat_ws(',',1,2,3,4,5,6,7,8,NULL,9,10,11,12);
} {1,2,3,4,5,6,7,8,9,10,11,12}
do_execsql_test func9-131 {
SELECT concat_ws(',',1,2,3,4,'',6,7,8,NULL,9,10,11,12);
} {1,2,3,4,,6,7,8,9,10,11,12}
do_execsql_test func9-140 {
SELECT concat_ws(NULL,1,2,3,4,5,6,7,8,NULL,9,10,11,12);
} {{}}
do_catchsql_test func9-150 {
SELECT concat_ws();
} {1 {wrong number of arguments to function concat_ws()}}
do_catchsql_test func9-160 {
SELECT concat_ws(',');
} {1 {wrong number of arguments to function concat_ws()}}
# https://sqlite.org/forum/forumpost/4c344ca61f (2025-03-02)
do_execsql_test func9-200 {
SELECT unistr('G\u00e4ste');
} {Gäste}
do_execsql_test func9-210 {
SELECT unistr_quote(unistr('G\u00e4ste'));
} {'Gäste'}
do_execsql_test func9-220 {
SELECT format('%#Q',unistr('G\u00e4ste'));
} {'Gäste'}
finish_test