interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / func9.test

66 lines · 2019 bytes Raw Blame History
1# 2023-08-29
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# Test cases for some newer SQL functions
13#
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16
17do_execsql_test func9-100 {
18 SELECT concat('abc',123,null,'xyz');
19} {abc123xyz}
20do_execsql_test func9-110 {
21 SELECT typeof(concat(null));
22} {text}
23do_catchsql_test func9-120 {
24 SELECT concat();
25} {1 {wrong number of arguments to function concat()}}
26do_execsql_test func9-130 {
27 SELECT concat_ws(',',1,2,3,4,5,6,7,8,NULL,9,10,11,12);
28} {1,2,3,4,5,6,7,8,9,10,11,12}
29do_execsql_test func9-131 {
30 SELECT concat_ws(',',1,2,3,4,'',6,7,8,NULL,9,10,11,12);
31} {1,2,3,4,,6,7,8,9,10,11,12}
32do_execsql_test func9-132 {
33 SELECT concat_ws(',','',2,3,4,'',6,7,8,NULL,9,10,11,12);
34} {,2,3,4,,6,7,8,9,10,11,12}
35do_execsql_test func9-133 {
36 SELECT concat_ws(',',NULL,'',3,4,'',6,7,8,NULL,9,10,11,12);
37} {,3,4,,6,7,8,9,10,11,12}
38do_execsql_test func9-134 {
39 SELECT concat_ws(',',NULL,NULL,NULL,'',3,4,'',6,7,8,NULL,9,10,11,12);
40} {,3,4,,6,7,8,9,10,11,12}
41do_execsql_test func9-140 {
42 SELECT concat_ws(NULL,1,2,3,4,5,6,7,8,NULL,9,10,11,12);
43} {{}}
44do_catchsql_test func9-150 {
45 SELECT concat_ws();
46} {1 {wrong number of arguments to function concat_ws()}}
47do_catchsql_test func9-160 {
48 SELECT concat_ws(',');
49} {1 {wrong number of arguments to function concat_ws()}}
50
51# https://sqlite.org/forum/forumpost/4c344ca61f (2025-03-02)
52do_execsql_test func9-200 {
53 SELECT unistr('G\u00e4ste');
54} {Gäste}
55do_execsql_test func9-210 {
56 SELECT unistr_quote(unistr('G\u00e4ste'));
57} {'Gäste'}
58do_execsql_test func9-220 {
59 SELECT format('%#Q',unistr('G\u00e4ste'));
60} {'Gäste'}
61
62do_execsql_test func9-300 {
63 SELECT hex( unistr('\UFFFFFFFF') )
64} {F7BFBFBF}
65
66finish_test