diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2018-10-19 09:59:14 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2018-10-19 09:59:14 (GMT) |
commit | 09446c7544e32d0eca9c0c68d7917729e6c33ee8 (patch) | |
tree | acfbdbcbc14ed32d57cbd251e815f92c96b53460 /tests/oo.test | |
parent | 8a4ad6884b04ca65ca5da3e350eb8265cc646e61 (diff) | |
download | tcl-09446c7544e32d0eca9c0c68d7917729e6c33ee8.zip tcl-09446c7544e32d0eca9c0c68d7917729e6c33ee8.tar.gz tcl-09446c7544e32d0eca9c0c68d7917729e6c33ee8.tar.bz2 |
Added another test case. This one is OK.
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 0558746..db5c14f 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1888,6 +1888,22 @@ test oo-13.10 {OO: changing an object's class: roots are special} -setup { } -cleanup { interp delete $i } -returnCodes error -result {may not modify the class of the class of classes} +test oo-13.11 {OO: changing an object's class in a tricky place} -setup { + oo::class create cls + unset -nocomplain result +} -body { + set result gorp + list [catch { + oo::define cls { + method x {} {return} + self class oo::object + ::set ::result ok + method y {} {return}; # I'm sorry, Dave. I'm afraid I can't do that. + } + } msg] $msg $result +} -cleanup { + cls destroy +} -result {1 {attempt to misuse API} ok} # todo: changing a class subtype (metaclass) to another class subtype test oo-14.1 {OO: mixins} { |