summaryrefslogtreecommitdiffstats
path: root/tests/upvar.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-12-07 16:32:06 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-12-07 16:32:06 (GMT)
commit47c3450e87baedd6fc319e0c3bc88e678f69a421 (patch)
tree20f9f770a15e075fbdfb3554c8131e2a660f79c8 /tests/upvar.test
parent161037972186f1887c20f00bafdb708c3c87fdca (diff)
downloadtcl-47c3450e87baedd6fc319e0c3bc88e678f69a421.zip
tcl-47c3450e87baedd6fc319e0c3bc88e678f69a421.tar.gz
tcl-47c3450e87baedd6fc319e0c3bc88e678f69a421.tar.bz2
* tests/fCmd.test, tests/safe.test, tests/uplevel.test,
* tests/upvar.test, tests/var.test: Convert more tests to tcltest2 and factor them to be easier to understand.
Diffstat (limited to 'tests/upvar.test')
-rw-r--r--tests/upvar.test181
1 files changed, 84 insertions, 97 deletions
diff --git a/tests/upvar.test b/tests/upvar.test
index dbf6dd5..90ba0b1 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: upvar.test,v 1.20 2010/02/10 23:28:39 dkf Exp $
+# RCS: @(#) $Id: upvar.test,v 1.21 2010/12/07 16:32:06 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -427,116 +427,103 @@ namespace eval test_ns_0 {
}
set ::x test_global
-test upvar-NS-1.1 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
+test upvar-NS-1.1 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ namespace upvar ::test_ns_0 x w
+ set w
+ }
+} -result {test_ns_0} -cleanup {
+ namespace delete test_ns_1
+}
+test upvar-NS-1.2 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ proc a {} {
namespace upvar ::test_ns_0 x w
set w
}
- } \
- -result {test_ns_0} \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.2 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- proc a {} {
- namespace upvar ::test_ns_0 x w
- set w
- }
- return [a]
- }
- } \
- -result {test_ns_0} \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.3 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
+ return [a]
+ }
+} -result {test_ns_0} -cleanup {
+ namespace delete test_ns_1
+}
+test upvar-NS-1.3 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ namespace upvar test_ns_0 x w
+ set w
+ }
+} -returnCodes error -cleanup {
+ namespace delete test_ns_1
+} -result {namespace "test_ns_0" not found in "::test_ns_1"}
+test upvar-NS-1.4 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ proc a {} {
namespace upvar test_ns_0 x w
set w
}
- } \
- -result {namespace "test_ns_0" not found in "::test_ns_1"} \
- -returnCodes error \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.4 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- proc a {} {
- namespace upvar test_ns_0 x w
- set w
- }
- return [a]
- }
- } \
- -result {namespace "test_ns_0" not found in "::test_ns_1"} \
- -returnCodes error \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.5 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- namespace eval test_ns_0 {}
+ return [a]
+ }
+} -returnCodes error -cleanup {
+ namespace delete test_ns_1
+} -result {namespace "test_ns_0" not found in "::test_ns_1"}
+
+test upvar-NS-1.5 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ namespace eval test_ns_0 {}
+ namespace upvar test_ns_0 x w
+ set w
+ }
+} -cleanup {
+ namespace delete test_ns_1
+} -result {can't read "w": no such variable} -returnCodes error
+test upvar-NS-1.6 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ namespace eval test_ns_0 {}
+ proc a {} {
namespace upvar test_ns_0 x w
set w
}
- } \
- -result {can't read "w": no such variable} \
- -returnCodes error \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.6 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- namespace eval test_ns_0 {}
- proc a {} {
- namespace upvar test_ns_0 x w
- set w
- }
- return [a]
+ return [a]
+ }
+} -cleanup {
+ namespace delete test_ns_1
+} -result {can't read "w": no such variable} -returnCodes error
+test upvar-NS-1.7 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ namespace eval test_ns_0 {
+ variable x test_ns_1::test_ns_0
+ }
+ namespace upvar test_ns_0 x w
+ set w
+ }
+} -cleanup {
+ namespace delete test_ns_1
+} -result {test_ns_1::test_ns_0}
+test upvar-NS-1.8 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ namespace eval test_ns_0 {
+ variable x test_ns_1::test_ns_0
}
- } \
- -result {can't read "w": no such variable} \
- -returnCodes error \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.7 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- namespace eval test_ns_0 {
- variable x test_ns_1::test_ns_0
- }
+ proc a {} {
namespace upvar test_ns_0 x w
set w
}
- } \
- -result {test_ns_1::test_ns_0} \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.8 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- namespace eval test_ns_0 {
- variable x test_ns_1::test_ns_0
- }
- proc a {} {
- namespace upvar test_ns_0 x w
- set w
- }
- return [a]
- }
- } \
- -result {test_ns_1::test_ns_0} \
- -cleanup {namespace delete test_ns_1}
-test upvar-NS-1.9 {nsupvar links to correct variable} \
- -body {
- namespace eval test_ns_1 {
- variable x test_ns_1
- proc a {} {
- namespace upvar test_ns_0 x w
- set w
- }
- return [a]
+ return [a]
+ }
+} -cleanup {
+ namespace delete test_ns_1
+} -result {test_ns_1::test_ns_0}
+test upvar-NS-1.9 {nsupvar links to correct variable} -body {
+ namespace eval test_ns_1 {
+ variable x test_ns_1
+ proc a {} {
+ namespace upvar test_ns_0 x w
+ set w
}
- } \
- -result {namespace "test_ns_0" not found in "::test_ns_1"} \
- -returnCodes error \
- -cleanup {namespace delete test_ns_1}
+ return [a]
+ }
+} -returnCodes error -cleanup {
+ namespace delete test_ns_1
+} -result {namespace "test_ns_0" not found in "::test_ns_1"}
test upvar-NS-2.1 {TIP 323} -returnCodes error -body {
namespace upvar