Skip to content

Commit 819f80e

Browse files
committed
amend to [987067386fa2edae]: adding coverage for constructor too (just to ensure we don't fall into the same trap by constructors)
1 parent 30f7837 commit 819f80e

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

tests/delete.test

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,41 @@ test delete-2.4 {object destructors get invoked properly} -body {
9191
set test_delete_watch {}
9292
} -result {::test_delete0 ::test_delete1 ::test_delete2 ::test_delete_base0 ::test_delete_base1 ::test_delete_base2}
9393

94-
test delete-2.5 {object destructors get invoked properly, bug [987067386fa2edae]} -setup {
94+
test delete-2.5 {object constructors and destructors get invoked properly, bug [987067386fa2edae]} -setup {
9595
variable ::test_delete_watch {}
9696
itcl::class ::test_delete_base {
97+
constructor {} {} {
98+
global ::test_delete_watch
99+
lappend test_delete_watch "++ base $this"
100+
}
97101
destructor {
98102
global ::test_delete_watch
99-
lappend test_delete_watch "base $this"
103+
lappend test_delete_watch "-- base $this"
100104
}
101105
}
102106
namespace eval itcl_test_ns {
103107
# class in NS with different name than base
104108
itcl::class test_delete_other {
105109
inherit ::test_delete_base
110+
constructor {} ::test_delete_base::constructor {
111+
global ::test_delete_watch
112+
lappend test_delete_watch "++ derivate-other $this"
113+
}
106114
destructor {
107115
global ::test_delete_watch
108-
lappend test_delete_watch "derivate-other $this"
116+
lappend test_delete_watch "-- derivate-other $this"
109117
}
110118
}
111119
# class in NS with different name than base
112120
itcl::class test_delete_base {
113121
inherit ::test_delete_base
122+
constructor {} ::test_delete_base::constructor {
123+
global ::test_delete_watch
124+
lappend test_delete_watch "++ derivate-same $this"
125+
}
114126
destructor {
115127
global ::test_delete_watch
116-
lappend test_delete_watch "derivate-same $this"
128+
lappend test_delete_watch "-- derivate-same $this"
117129
}
118130
}
119131
}
@@ -126,7 +138,12 @@ test delete-2.5 {object destructors get invoked properly, bug [987067386fa2edae]
126138
set test_delete_watch {}
127139
namespace delete itcl_test_ns
128140
itcl::delete class ::test_delete_base
129-
} -result {{derivate-other ::test_del_other} {base ::test_del_other} {derivate-same ::test_del_base} {base ::test_del_base}}
141+
} -result [list {*}{
142+
{++ base ::test_del_other} {++ derivate-other ::test_del_other}
143+
{++ base ::test_del_base} {++ derivate-same ::test_del_base}
144+
{-- derivate-other ::test_del_other} {-- base ::test_del_other}
145+
{-- derivate-same ::test_del_base} {-- base ::test_del_base}
146+
}]
130147

131148
# ----------------------------------------------------------------------
132149
# Deleting class namespaces

0 commit comments

Comments
 (0)