zlib: Don't use PASTE for INTMAX error messages
[jimtcl.git] / tests / procref.test
bloba9fdf41133c1099ce49e422718ad9ee1bcc6423e
1 # Tests auto-upref with the "&name" syntax
3 source [file dirname [info script]]/testing.tcl
5 needs constraint jim
7 proc a1 {&b c} {
8         append b b
9         append c c
12 proc a2 {&b {dummy 3} &c} {
13         append b b
14         append c c
17 proc a3 {&b(c)} {
18         append b(c) b_c
21 # This is treated as a normal var "&b"
22 proc a4 {{&b x}} {
23         append &b B
26 set B 1
27 set C 1
29 test procref-1.1 {Basic test} {
30         a1 B $C
31         set B
32 } {1b}
34 test procref-1.2 {Basic test} {
35         a1 B $C
36         set B
37 } {1bb}
39 test procref-1.3 {Unset var} -body {
40         a1 unsetB $C
41 } -returnCodes error -result {can't read "unsetB": no such variable}
43 test procref-1.4 {Left and right args are refs} {
44         a2 B C
45         list $B $C
46 } {1bbb 1c}
48 test procref-1.5 {Invalid arg} -body {
49         a3 B
50 } -returnCodes error -result {bad variable name "b(c)": upvar won't create a scalar variable that looks like an array element}
52 test procref-1.6 {Default arg as ref} {
53         a4
54 } xB
56 testreport