summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-04-09 17:04:21 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-04-09 17:04:21 (GMT)
commit4d8a945fc474dc4d42a6c0903f3eb2e0b62bd9a4 (patch)
treed35f80a30685a95f0b98dc38546d12af55a97bc1 /tests/oo.test
parent019db2eeac52e67aea6dfa380fb13f84f06889ca (diff)
downloadtcl-4d8a945fc474dc4d42a6c0903f3eb2e0b62bd9a4.zip
tcl-4d8a945fc474dc4d42a6c0903f3eb2e0b62bd9a4.tar.gz
tcl-4d8a945fc474dc4d42a6c0903f3eb2e0b62bd9a4.tar.bz2
Fix [Bug 2712377]: [info vars] and object declared variables
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test
index 8c5aeb3..a0e7345 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -2946,6 +2946,78 @@ test oo-27.18 {variables declaration - multiple use} -setup {
foo create bar
list [bar boo] [bar boo]
} -returnCodes error -match glob -result {unknown method "-?": must be *}
+test oo-27.19 {variables declaration and [info vars]: Bug 2712377} -setup {
+ oo::class create Foo
+ set result {}
+} -body {
+ # This is really a test of problems to do with Tcl's introspection when a
+ # variable resolver is present...
+ oo::define Foo {
+ variable foo bar
+ method setvars {f b} {
+ set foo $f
+ set bar $b
+ }
+ method dump1 {} {
+ lappend ::result <1>
+ foreach v [lsort [info vars *]] {
+ lappend ::result $v=[set $v]
+ }
+ lappend ::result [info locals] [info locals *]
+ }
+ method dump2 {} {
+ lappend ::result <2>
+ foreach v [lsort [info vars *]] {
+ lappend ::result $v=[set $v]
+ }
+ lappend ::result | foo=$foo [info locals] [info locals *]
+ }
+ }
+
+ Foo create stuff
+ stuff setvars what ever
+ stuff dump1
+ stuff dump2
+ return $result
+} -cleanup {
+ Foo destroy
+} -result {<1> bar=ever foo=what v v <2> bar=ever foo=what | foo=what v v}
+test oo-27.20 {variables declaration and [info vars]: Bug 2712377} -setup {
+ oo::class create Foo
+ set result {}
+} -body {
+ # This is really a test of problems to do with Tcl's introspection when a
+ # variable resolver is present...
+ oo::define Foo {
+ variable foo bar
+ method setvars {f b} {
+ set foo $f
+ set bar $b
+ }
+ method dump1 {} {
+ lappend ::result <1>
+ foreach v [lsort [info vars *o]] {
+ lappend ::result $v=[set $v]
+ }
+ lappend ::result [info locals] [info locals *]
+ }
+ method dump2 {} {
+ lappend ::result <2>
+ foreach v [lsort [info vars *o]] {
+ lappend ::result $v=[set $v]
+ }
+ lappend ::result | foo=$foo [info locals] [info locals *]
+ }
+ }
+
+ Foo create stuff
+ stuff setvars what ever
+ stuff dump1
+ stuff dump2
+ return $result
+} -cleanup {
+ Foo destroy
+} -result {<1> foo=what v v <2> foo=what | foo=what v v}
# A feature that's not supported because the mechanism may change without
# warning, but is supposed to work...