summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-05-15 13:04:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-05-15 13:04:10 (GMT)
commite6fdfbe93b022e8ac8dc26c7de9706b7b45d422f (patch)
tree2573310b16ebdfcea2159a4b30d2c0b07bea71e7 /tests/oo.test
parentbd706be303307bc4bdeacf15c1af1a43f1585d6b (diff)
downloadtcl-e6fdfbe93b022e8ac8dc26c7de9706b7b45d422f.zip
tcl-e6fdfbe93b022e8ac8dc26c7de9706b7b45d422f.tar.gz
tcl-e6fdfbe93b022e8ac8dc26c7de9706b7b45d422f.tar.bz2
Make [info object methods] and [info class methods] work right.
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test
index 9aedaaf..9563b4f 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -4691,6 +4691,42 @@ test oo-39.11 {TIP 500: private methods; call chain caching and reporting} -setu
} -cleanup {
parent destroy
} -result {{{{method chain ::cls method}} 0} {{{method chain ::cls method}} 0} {{{private chain ::cls2 method} {method chain ::cls method}} 1} {{{private chain ::cls2 method} {method chain ::cls method}} 1}}
+test oo-39.12 {TIP 500: private methods; introspection} -setup {
+ oo::class create parent
+} -body {
+ oo::class create cls {
+ superclass parent
+ method chain {} {
+ return [self call]
+ }
+ private method abc {} {}
+ }
+ oo::class create cls2 {
+ superclass cls
+ method chain2 {} {
+ my chain
+ }
+ method chain3 {} {
+ [self] chain
+ }
+ private method def {} {}
+ unexport chain3
+ }
+ cls create a
+ cls2 create b
+ oo::objdefine b {
+ private method ghi {} {}
+ method ABC {} {}
+ method foo {} {}
+ }
+ set scopes {public unexported private}
+ list a: [lmap s $scopes {info object methods a -scope $s}] \
+ b: [lmap s $scopes {info object methods b -scope $s}] \
+ cls: [lmap s $scopes {info class methods cls -scope $s}] \
+ cls2: [lmap s $scopes {info class methods cls2 -scope $s}] \
+} -cleanup {
+ parent destroy
+} -result {a: {{} {} {}} b: {foo ABC ghi} cls: {chain {} abc} cls2: {chain2 chain3 def}}
cleanupTests
return