summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-05-06 07:13:30 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-05-06 07:13:30 (GMT)
commit2a19591dc76f5811ee0ebacb3610cad0ff165aec (patch)
treee74b137b7c0feb3444524fa8d8a80769d1c8fe0d /tests/oo.test
parent411bfad9f4e43665addd2312735cc591dc8520f9 (diff)
downloadtcl-2a19591dc76f5811ee0ebacb3610cad0ff165aec.zip
tcl-2a19591dc76f5811ee0ebacb3610cad0ff165aec.tar.gz
tcl-2a19591dc76f5811ee0ebacb3610cad0ff165aec.tar.bz2
Fix up instance privates.
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test
index 1075d0d..8a1718e 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -4407,6 +4407,50 @@ test oo-38.3 {TIP 500: private methods internal call} -setup {
} -cleanup {
parent destroy
} -result {16 22}
+test oo-38.4 {TIP 500: private methods internal call} -setup {
+ oo::class create parent
+} -body {
+ oo::class create clsA {
+ superclass parent
+ variable x
+ constructor {} {
+ set x 1
+ }
+ method act {} {
+ my step
+ return
+ }
+ method step {} {
+ incr x
+ }
+ method x {} {
+ return $x
+ }
+ }
+ clsA create obj
+ obj act
+ set result [obj x]
+ oo::objdefine obj {
+ variable x
+ private {
+ method step {} {
+ incr x 2
+ }
+ }
+ }
+ obj act
+ lappend result [obj x]
+ oo::objdefine obj {
+ method act {} {
+ my step
+ next
+ }
+ }
+ obj act
+ lappend result [obj x]
+} -cleanup {
+ parent destroy
+} -result {2 3 6}
cleanupTests
return