summaryrefslogtreecommitdiffstats
path: root/tests/ooNext2.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2014-08-28 07:53:24 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2014-08-28 07:53:24 (GMT)
commit85b2c63c51c49dc03b1b29f3d8b14dcde5501680 (patch)
tree8a81a07f57f071caba13123fa549a0447b7706db /tests/ooNext2.test
parent8b3c95a3f228ab5efd2bf8be53a492032ed5240b (diff)
downloadtcl-85b2c63c51c49dc03b1b29f3d8b14dcde5501680.zip
tcl-85b2c63c51c49dc03b1b29f3d8b14dcde5501680.tar.gz
tcl-85b2c63c51c49dc03b1b29f3d8b14dcde5501680.tar.bz2
[b9e1a3032e] Implement the documented method search order for TclOO.
This corrects the relative positions of object-defined methods and class mixins.
Diffstat (limited to 'tests/ooNext2.test')
-rw-r--r--tests/ooNext2.test87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/ooNext2.test b/tests/ooNext2.test
index a47aa91..9a63577 100644
--- a/tests/ooNext2.test
+++ b/tests/ooNext2.test
@@ -526,6 +526,93 @@ test oo-call-1.19 {object call introspection - memory leaks} -setup {
} -cleanup {
leaktester destroy
} -constraints memory -result 0
+test oo-call-1.20 {object call introspection - complex case} -setup {
+ oo::class create root
+} -body {
+ oo::class create ::A {
+ superclass root
+ method x {} {}
+ }
+ oo::class create ::B {
+ superclass A
+ method x {} {}
+ }
+ oo::class create ::C {
+ superclass root
+ method x {} {}
+ mixin B
+ }
+ oo::class create ::D {
+ superclass C
+ method x {} {}
+ }
+ oo::class create ::E {
+ superclass root
+ method x {} {}
+ }
+ oo::class create ::F {
+ superclass E
+ method x {} {}
+ }
+ oo::class create ::G {
+ superclass root
+ method x {} {}
+ }
+ oo::class create ::H {
+ superclass G
+ method x {} {}
+ }
+ oo::define F mixin H
+ F create y
+ oo::objdefine y {
+ method x {} {}
+ mixin D
+ }
+ info object call y x
+} -cleanup {
+ root destroy
+} -result {{method x ::D method} {method x ::B method} {method x ::A method} {method x ::C method} {method x ::H method} {method x ::G method} {method x object method} {method x ::F method} {method x ::E method}}
+test oo-call-1.21 {object call introspection - complex case} -setup {
+ oo::class create root
+} -body {
+ oo::class create ::A {
+ superclass root
+ method y {} {}
+ filter y
+ }
+ oo::class create ::B {
+ superclass A
+ method y {} {}
+ }
+ oo::class create ::C {
+ superclass root
+ method x {} {}
+ mixin B
+ }
+ oo::class create ::D {
+ superclass C
+ filter x
+ }
+ oo::class create ::E {
+ superclass root
+ method y {} {}
+ method x {} {}
+ }
+ oo::class create ::F {
+ superclass E
+ method z {} {}
+ method q {} {}
+ }
+ F create y
+ oo::objdefine y {
+ method unknown {} {}
+ mixin D
+ filter q
+ }
+ info object call y z
+} -cleanup {
+ root destroy
+} -result {{filter x ::C method} {filter x ::E method} {filter y ::B method} {filter y ::A method} {filter y ::E method} {filter q ::F method} {method z ::F method}}
test oo-call-2.1 {class call introspection} -setup {
oo::class create root