diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2018-07-01 16:39:11 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2018-07-01 16:39:11 (GMT) |
commit | d11660acfec5e51e088b6e9661d3b6b8e0b1988a (patch) | |
tree | 782e4d22dd859468068ba169beeaba9da4136994 /tests/ooUtil.test | |
parent | 5c7ba37901819efd8c30dee373dada97eafdce04 (diff) | |
download | tcl-d11660acfec5e51e088b6e9661d3b6b8e0b1988a.zip tcl-d11660acfec5e51e088b6e9661d3b6b8e0b1988a.tar.gz tcl-d11660acfec5e51e088b6e9661d3b6b8e0b1988a.tar.bz2 |
Create a special command, [ :my:class], (in each instance namespace) that allows objects to delegate methods to their class.
Diffstat (limited to 'tests/ooUtil.test')
-rw-r--r-- | tests/ooUtil.test | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/ooUtil.test b/tests/ooUtil.test index 77fa175..28ab9c7 100644 --- a/tests/ooUtil.test +++ b/tests/ooUtil.test @@ -96,7 +96,7 @@ test ooUtil-1.5 {TIP 478: classmethod and instances} -setup { $t find 1 2 3 } -cleanup { parent destroy -} -result {::ActiveRecord called with arguments: 1 2 3} +} -result {::Table called with arguments: 1 2 3} test ooUtil-1.6 {TIP 478: classmethod and instances} -setup { oo::class create parent } -body { @@ -115,6 +115,29 @@ test ooUtil-1.6 {TIP 478: classmethod and instances} -setup { } -returnCodes error -cleanup { parent destroy } -match glob -result {unknown method "find": must be *} +test ooUtil-1.7 {} -setup { + oo::class create parent +} -body { + oo::class create Foo { + superclass parent + classmethod bar {} { + puts "This is in the class; self is [self]" + my meee + } + classmethod meee {} { + puts "This is meee" + } + } + oo::class create Grill { + superclass Foo + classmethod meee {} { + puts "This is meee 2" + } + } + list [Foo bar] [Grill bar] [[Foo new] bar] [[Grill new] bar] +} -cleanup { + parent destroy +} -result {{} {} {} {}} -output "This is in the class; self is ::Foo\nThis is meee\nThis is in the class; self is ::Grill\nThis is meee 2\nThis is in the class; self is ::Foo\nThis is meee\nThis is in the class; self is ::Grill\nThis is meee 2\n" test ooUtil-2.1 {TIP 478: callback generation} -setup { oo::class create parent |