summaryrefslogtreecommitdiffstats
path: root/tests/ooUtil.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-07-06 13:50:54 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-07-06 13:50:54 (GMT)
commit969f9f571cda6f6b8db32f8b9cdf922715b37c43 (patch)
treeedea7e82d38a056697016644cde74a2afaaaf853 /tests/ooUtil.test
parent414bcee273fa2ac3fbc1e329f65d1ae7396a22a4 (diff)
downloadtcl-969f9f571cda6f6b8db32f8b9cdf922715b37c43.zip
tcl-969f9f571cda6f6b8db32f8b9cdf922715b37c43.tar.gz
tcl-969f9f571cda6f6b8db32f8b9cdf922715b37c43.tar.bz2
Improving the singleton
Diffstat (limited to 'tests/ooUtil.test')
-rw-r--r--tests/ooUtil.test25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/ooUtil.test b/tests/ooUtil.test
index 28ab9c7..e00c70c 100644
--- a/tests/ooUtil.test
+++ b/tests/ooUtil.test
@@ -298,12 +298,33 @@ test ooUtil-4.1 {TIP 478: singleton} -setup {
set z [xyz new]
set code [catch {$x destroy} msg]
set p [xyz new]
- lappend code $msg [catch {rename $x ""}]
+ lappend code [catch {rename $x ""}]
set q [xyz new]
string map [list $x ONE $q TWO] [list {*}$code $x $y $z $p $q [xyz new]]
} -cleanup {
parent destroy
-} -result {1 {object "ONE" has no visible methods} 0 ONE ONE ONE ONE TWO TWO}
+} -result {1 0 ONE ONE ONE ONE TWO TWO}
+test ooUtil-4.2 {TIP 478: singleton errors} -setup {
+ oo::class create parent
+} -body {
+ oo::singleton create xyz {
+ superclass parent
+ }
+ [xyz new] destroy
+} -returnCodes error -cleanup {
+ parent destroy
+} -result {may not destroy a singleton object}
+test ooUtil-4.3 {TIP 478: singleton errors} -setup {
+ oo::class create parent
+} -body {
+ oo::singleton create xyz {
+ superclass parent
+ }
+ oo::copy [xyz new]
+} -returnCodes error -cleanup {
+ parent destroy
+} -result {may not clone a singleton object}
+
test ooUtil-5.1 {TIP 478: abstract} -setup {
oo::class create parent