diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2009-11-27 06:33:39 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2009-11-27 06:33:39 (GMT) |
commit | 26dda484fe7ad621e71585270c0a3c914c5fb375 (patch) | |
tree | a8cb0e0fd6a6503fbcb3dbd1f10132869fe916b4 /tests/oo.test | |
parent | dc3b82e5c4fef5b8efbdcef11cfc05216d88cc0c (diff) | |
download | tcl-26dda484fe7ad621e71585270c0a3c914c5fb375.zip tcl-26dda484fe7ad621e71585270c0a3c914c5fb375.tar.gz tcl-26dda484fe7ad621e71585270c0a3c914c5fb375.tar.bz2 |
[Bug 2903811]: Remove unneeded restrictions on usefully calling the
oo::object->variable method. Leaving it hidden is enough.
Diffstat (limited to 'tests/oo.test')
-rw-r--r-- | tests/oo.test | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/oo.test b/tests/oo.test index 4c289ab..b07b536 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.31 2009/11/24 12:00:08 dkf Exp $ +# RCS: @(#) $Id: oo.test,v 1.32 2009/11/27 06:33:40 dkf Exp $ package require TclOO 0.6.1 ;# Must match value in generic/tclOO.h if {[lsearch [namespace children] ::tcltest] == -1} { @@ -1815,6 +1815,39 @@ test oo-20.12 {OO: variable method accept zero args (TIP 323)} -setup { } foo demo } -result {} +test oo-20.13 {OO: variable method use in non-methods [Bug 2903811]} -setup { + oo::object create fooObj + oo::objdefine fooObj export variable +} -cleanup { + fooObj destroy +} -body { + apply {{} {fooObj variable x; set x ok; return}} + apply {{} {fooObj variable x; return $x}} +} -result ok +test oo-20.14 {OO: variable method use in non-methods [Bug 2903811]} -setup { + oo::object create fooObj + oo::objdefine fooObj export variable + namespace eval ns1 {} + namespace eval ns2 {} + set x bad +} -cleanup { + fooObj destroy + namespace delete ns1 ns2 + unset x +} -body { + namespace eval ns1 {fooObj variable x; set x ok; subst ""} + set x bad + namespace eval ns2 {fooObj variable x; return $x} +} -result ok +test oo-20.15 {OO: variable method use in non-methods [Bug 2903811]} -setup { + oo::object create fooObj + oo::objdefine fooObj export variable varname +} -cleanup { + fooObj destroy +} -body { + apply {{} {fooObj variable x; set x ok; return}} + return [set [fooObj varname x]] +} -result ok test oo-21.1 {OO: inheritance ordering} -setup { oo::class create A |