zlib: Don't use PASTE for INTMAX error messages
[jimtcl.git] / tests / concat.test
blob79aec87b887473836b8032ca2eccd1d05272810d
1 source [file dirname [info script]]/testing.tcl
3 test concat-1.1 {simple concatenation} {
4     concat a b c d e f g
5 } {a b c d e f g}
6 test concat-1.2 {merging lists together} {
7     concat a {b c d} {e f g h}
8 } {a b c d e f g h}
9 test concat-1.3 {merge lists, retain sub-lists} {
10     concat a {b {c d}} {{e f}} g h
11 } {a b {c d} {e f} g h}
12 test concat-1.4 {special characters} {
13     concat a\{ {b \{c d} \{d
14 } "a{ b \\{c d {d"
16 test concat-2.1 {error check: one empty argument} {
17     concat {}
18 } {}
20 test concat-3.1 {error check: no arguments} {
21     list [catch concat msg] $msg
22 } {0 {}}
24 test concat-4.1 {pruning off extra white space} {
25     concat {} {a b c}
26 } {a b c}
27 test concat-4.2 {pruning off extra white space} {
28     concat x y "  a b c \n\t  " "   "  " def "
29 } {x y a b c def}
30 test concat-4.3 {pruning off extra white space sets length correctly} {
31     llength [concat { {{a}} }]
32 } 1
34 test concat-5.1 {Tcl_ScanCountedElement procedure - don't leave unmatched braces} {
35     # This test checks for a very tricky feature.  Any list element
36     # generated with Tcl_ScanCountedElement and Tcl_ConvertElement must
37     # have the property that it can be enclosing in curly braces to make
38     # an embedded sub-list.  If this property doesn't hold, then
39     # Tcl_DStringStartSublist doesn't work.
41     set x {}
42     lappend x " \\\{ \\"
43     concat $x [llength "{$x}"]
44 } {\ \\\{\ \\ 1}
46 test concat-6.1 {Tcl_ConcatObj - backslash-space at end of argument} {
47     concat a {b\ } c
48 } {a b\  c}
49 test concat-6.2 {Tcl_ConcatObj - backslash-space at end of argument} {
50     concat a {b\   } c
51 } {a b\  c}
52 test concat-6.3 {Tcl_ConcatObj - backslash-space at end of argument} {
53     concat a {b\\   } c
54 } {a b\\  c}
55 test concat-6.4 {Tcl_ConcatObj - backslash-space at end of argument} {
56     concat a {b } c
57 } {a b c}
58 test concat-6.5 {Tcl_ConcatObj - backslash-space at end of argument} {
59     concat a { } c
60 } {a c}
61 test concat-6.6 {Tcl_ConcatObj - utf-8 sequence with "whitespace" char} {
62     # Check for Bug #227512.  If this violates C isspace, then it returns \xc3.
63     concat \xe0
64 } \xe0
66 testreport