diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-05 00:35:57 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-03-05 00:35:57 (GMT) |
commit | 4b803ccfb006b7d5592b866cdeb106bd1cf2fbd5 (patch) | |
tree | dc5e2c9a6260b924b0812e00d961eb79fe9fe786 /tests/oo.test | |
parent | 64eb210f2c0a38f2c40ccfe5d432633d88e0be39 (diff) | |
parent | dac6a38b04d340580342f96033bbaa45ba1c79a4 (diff) | |
download | tcl-4b803ccfb006b7d5592b866cdeb106bd1cf2fbd5.zip tcl-4b803ccfb006b7d5592b866cdeb106bd1cf2fbd5.tar.gz tcl-4b803ccfb006b7d5592b866cdeb106bd1cf2fbd5.tar.bz2 |
[Bug 3185009]: Keep references to resolved object variables so that an unset doesn't leave any dangling pointers for code to trip over.
Diffstat (limited to 'tests/oo.test')
-rw-r--r-- | tests/oo.test | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/oo.test b/tests/oo.test index 395e345..60d0077 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2578,6 +2578,22 @@ test oo-27.12 {variables declaration: leak per instance} -setup { } -cleanup { foo destroy } -result 0 +# This test will actually (normally) crash if it fails! +test oo-27.13 {variables declaration: Bug 3185009: require refcount management} -setup { + oo::object create foo +} -body { + oo::objdefine foo { + variable x + method set v {set x $v} + method unset {} {unset x} + method exists {} {info exists x} + method get {} {return $x} + } + list [foo exists] [foo set 7] [foo exists] [foo get] [foo unset] \ + [foo exists] [catch {foo get} msg] $msg +} -cleanup { + foo destroy +} -result {0 7 1 7 {} 0 1 {can't read "x": no such variable}} # A feature that's not supported because the mechanism may change without # warning, but is supposed to work... |