forked from pmichaud/pmtcl
/
cmd_list.t
executable file
·41 lines (31 loc) · 1.36 KB
/
cmd_list.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright (C) 2004-2006, The Parrot Foundation.
source lib/test_more.tcl
plan 24
is [list] {} {no elements}
is [list a] {a} {one element}
is [list a b] {a b} {two elements}
is [list a b {c {d e}}] {a b {c {d e}}} {spaces with braces}
is [list a b "c {d e}"] {a b {c {d e}}} {spaces with quotes}
is [list {1 2} {3 4}] {{1 2} {3 4}} {spaces in two elements}
is [list "} {"] {\}\ \{} {braces with spaces}
is [list \{ \}] {\{ \}} {braces}
is [list "\n"] "{\n}" {newline}
is [list ";"] {{;}} {semicolon}
is [list "\t"] "{\t}" {tab}
is [list "$"] {{$}} {dollar}
is [list "\\"] {\\} {backslash} {TODO NQPRX}
is [list \[] {{[}} {open bracket}
is [list \]] {\]} {close bracket}
# hashes are protected only if they're the first char in the first element.
is [list #] {{#}} {comment hash}
is [list #foo] {{#foo}} {comment hash}
is [list #foo #bar] {{#foo} #bar} {comment hash}
# hairy one that catches us on subst.test
is [list "\x\$x\[foo bar]\\"] {x\$x\[foo\ bar\]\\} {trailing backslash} {TODO NQPRX}
# from list.test
is [list {"}] {{"}} {single quote}
is [list "{ab}xy"] "{{ab}xy}" {braces that don't wrap exactly}
is [list "{ab}\\"] "\\{ab\\}\\\\" {braces that don't wrap exactly, trailing backslash}
is [list \{\r] "\\\{\\r" {use standard \foo escapes when stringifying a list}
is [list \{"] {\{\"} {escape quotes}
# vim: filetype=tcl: