1 source [file dirname [info script]]/testing.tcl
7 test alias-1.1 "One word alias" {
13 test alias-1.4 "Two word alias" {
14 alias infoexists info exists
18 test alias-1.5 "Replace alias" {
19 alias newincr infoexists
23 test alias-1.6 "Delete alias" {
28 test alias-1.7 "Replace alias with proc" {
35 test alias-1.8 "Replace proc with alias" {
36 alias infoexists info exists
40 test alias-1.9 "error message from alias" -body {
41 alias newstring string
43 } -returnCodes error -result {wrong # args: should be "string match ?-nocase? pattern string"}
45 test alias-1.10 "info alias" {
50 test alias-1.10 "info alias on non-alias" -body {
52 } -returnCodes error -result {command "format" is not an alias}
54 test curry-1.1 "One word curry" {
60 test curry-1.4 "Two word curry" {
61 set two [curry info exists]
62 list [$two x] [$two y]
65 test curry-1.5 "Delete curry" references {
71 test local-1.2 "local curry in proc" {
73 local set p [curry info exists]
77 lassign [a] p exists_x exists_y
78 list [info procs $p] $exists_x $exists_y
81 test local-1.2 "set local curry in proc" {
83 set p [local curry info exists]
87 lassign [a] p exists_x exists_y
88 list [info procs $p] $exists_x $exists_y
91 test local-1.3 "local alias in proc" {
93 local alias p info exists
97 lassign [a] exists_x exists_y
98 list [info commands p] $exists_x $exists_y
101 test local-1.5 "local proc in proc" {
104 local proc b {} { incr ::x }
109 list [info procs b] $::x
112 test local-1.6 "local lambda in lsort" {
114 lsort -command [local lambda {a b} {string compare $a $b}] {d a f g}
119 test local-1.7 "check no reference procs" {
120 info procs "<reference*"
123 test local-1.8 "local on non-existent command" {
124 list [catch {local set x blah} msg] $msg
125 } {1 {invalid command name "blah"}}
127 test local-1.9 "local on existing proc" {
131 set c [lambda b {incr b -1}]
133 lappend result [a 1] [$c 2]
136 list [info procs a] $result
139 test statics-1.1 "missing static variable init" {
143 # No initialiser for c
148 test statics-1.2 "static variable with invalid name" {
150 proc a {b} "{c\0d 4}" {
155 test statics-1.3 "duplicate static variable" {
157 proc a {b} {{c 1} {c 2}} {
162 test statics-1.4 "bad static variable init" {
164 proc a {b} {{c 1 2}} {
169 test local-2.1 "proc over existing proc" {
172 proc a {b} {incr b -1}
181 test local-2.2 "local proc over existing proc" {
184 local proc a {b} {incr b -1}
193 test local-2.3 "local proc over existing proc" {
196 local proc a {b} {incr b -1}
205 test upcall-1.1 "upcall pushed proc" {
209 # invoke the original defn via upcall
212 # Should call the new defn which will call the original defn
216 test upcall-1.2 "upcall in proc" {
231 test upcall-1.3 "double upcall" {
233 local proc a {} {list 2 {*}[upcall a]}
234 local proc a {} {list 3 {*}[upcall a]}
238 test upcall-1.4 "upcall errors" {
240 list [catch {upcall a} msg] $msg
241 } {1 {no previous command: "a"}}
243 test upcall-1.4 "upcall errors" {
245 list [catch a msg] $msg
246 } {1 {no previous command: "a"}}