summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-02-12 09:27:43 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-02-12 09:27:43 (GMT)
commitbf722c6315c4ee0b75907cb81d40c7d7a68bc938 (patch)
tree4d358b21e76dad6429c80c145a561e462c9e47bb /tests/oo.test
parentb58cb50d92072977c7a7ed1f51f7c928268a2be6 (diff)
downloadtcl-bf722c6315c4ee0b75907cb81d40c7d7a68bc938.zip
tcl-bf722c6315c4ee0b75907cb81d40c7d7a68bc938.tar.gz
tcl-bf722c6315c4ee0b75907cb81d40c7d7a68bc938.tar.bz2
Fix tricky point that meant it was next to impossible to extend [oo::define].
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/oo.test b/tests/oo.test
index e0b07b2..1f5573b 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -7,7 +7,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: oo.test,v 1.22 2009/01/29 15:57:54 dkf Exp $
+# RCS: @(#) $Id: oo.test,v 1.23 2009/02/12 09:27:44 dkf Exp $
package require TclOO 0.6.1 ;# Must match value in generic/tclOO.h
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -2164,6 +2164,25 @@ test oo-27.11 {variables declaration - no instance var leaks with class resolver
inst1 step
list [inst1 value] [inst2 value]
} -result {3 2}
+
+# A feature that's not supported because the mechanism may change without
+# warning, but is supposed to work...
+test oo-28.1 {scripted extensions to oo::define} -setup {
+ interp create foo
+ foo eval {oo::class create cls {export eval}}
+} -cleanup {
+ interp delete foo
+} -body {
+ foo eval {
+ proc oo::define::privateMethod {name arguments body} {
+ uplevel 1 [list method $name $arguments $body]
+ uplevel 1 [list unexport $name]
+ }
+ oo::define cls privateMethod m {x y} {return $x,$y}
+ cls create obj
+ list [catch {obj m 1 2}] [obj eval my m 3 4]
+ }
+} -result {1 3,4}
cleanupTests
return