summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-03-24 10:46:03 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-03-24 10:46:03 (GMT)
commit0dde2f0c154556f8f812078b8eb894e2d248974e (patch)
treef2cdaf7eb9bc628eb19e39845f3b0692bb49b4fd /tests/oo.test
parent08383aee88a03fe8cc880c10b9fc242fe3804ebd (diff)
downloadtcl-0dde2f0c154556f8f812078b8eb894e2d248974e.zip
tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.tar.gz
tcl-0dde2f0c154556f8f812078b8eb894e2d248974e.tar.bz2
Fix [Bug 2704302]
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/oo.test b/tests/oo.test
index 1f5573b..6c3187b 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.23 2009/02/12 09:27:44 dkf Exp $
+# RCS: @(#) $Id: oo.test,v 1.24 2009/03/24 10:46:04 dkf Exp $
package require TclOO 0.6.1 ;# Must match value in generic/tclOO.h
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -979,6 +979,20 @@ test oo-13.3 {OO: changing an object's class} -body {
} -cleanup {
foo destroy
} -returnCodes 1 -result {may not change a class object into a non-class object}
+test oo-13.4 {OO: changing an object's class} -body {
+ oo::class create foo {
+ method m {} {
+ set result [list [self class] [info object class [self]]]
+ oo::objdefine [self] class ::bar
+ lappend result [self class] [info object class [self]]
+ }
+ }
+ oo::class create bar
+ [foo new] m
+} -cleanup {
+ foo destroy
+ bar destroy
+} -result {::foo ::foo ::foo ::bar}
# todo: changing a class subtype (metaclass) to another class subtype
test oo-14.1 {OO: mixins} {
@@ -2183,6 +2197,17 @@ test oo-28.1 {scripted extensions to oo::define} -setup {
list [catch {obj m 1 2}] [obj eval my m 3 4]
}
} -result {1 3,4}
+
+test oo-29.1 {self class with object-defined methods} -setup {
+ oo::object create obj
+} -body {
+ oo::objdefine obj method demo {} {
+ self class
+ }
+ obj demo
+} -returnCodes error -cleanup {
+ obj destroy
+} -result {method not defined by a class}
cleanupTests
return