summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-11-24 12:00:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-11-24 12:00:08 (GMT)
commita20a036f3289a187283f242e8cd22fee976f3bfb (patch)
tree35a1ce0ce5c0d6b8d7b752c092b3816da7977434 /tests/oo.test
parentc48d854865fb1aa7c418cb6cd4ef39b5d7d0332f (diff)
downloadtcl-a20a036f3289a187283f242e8cd22fee976f3bfb.zip
tcl-a20a036f3289a187283f242e8cd22fee976f3bfb.tar.gz
tcl-a20a036f3289a187283f242e8cd22fee976f3bfb.tar.bz2
Ensure that destroying an object in a constructor doesn't crash. [Bug 2903011]
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/oo.test b/tests/oo.test
index a976a7d..4c289ab 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.30 2009/10/22 15:39:58 dkf Exp $
+# RCS: @(#) $Id: oo.test,v 1.31 2009/11/24 12:00:08 dkf Exp $
package require TclOO 0.6.1 ;# Must match value in generic/tclOO.h
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -2332,6 +2332,23 @@ test oo-29.1 {self class with object-defined methods} -setup {
} -returnCodes error -cleanup {
obj destroy
} -result {method not defined by a class}
+
+test oo-30.1 {Bug 2903011: deleting an object in a constructor} -setup {
+ oo::class create cls
+} -body {
+ oo::define cls {constructor {} {[self] destroy}}
+ cls new
+} -returnCodes error -cleanup {
+ cls destroy
+} -result {object deleted in constructor}
+test oo-30.2 {Bug 2903011: deleting an object in a constructor} -setup {
+ oo::class create cls
+} -body {
+ oo::define cls {constructor {} {my destroy}}
+ cls new
+} -returnCodes error -cleanup {
+ cls destroy
+} -result {object deleted in constructor}
cleanupTests
return