summaryrefslogtreecommitdiffstats
path: root/tests/oo.test
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2021-04-03 12:17:40 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2021-04-03 12:17:40 (GMT)
commit1c4c352fe9104950891533992dfbc449e75350aa (patch)
treeb58e6c6d518597c790881c7f3fbb870b49fd75d0 /tests/oo.test
parent743881d3ce722dbba89ec98a6f5a9618e683bbf1 (diff)
downloadtcl-1c4c352fe9104950891533992dfbc449e75350aa.zip
tcl-1c4c352fe9104950891533992dfbc449e75350aa.tar.gz
tcl-1c4c352fe9104950891533992dfbc449e75350aa.tar.bz2
New test for OO cleanup: routine for object gets deleted before namespace deletion
is complete.
Diffstat (limited to 'tests/oo.test')
-rw-r--r--tests/oo.test37
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/oo.test b/tests/oo.test
index 168baee..404c6a4 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -1734,6 +1734,7 @@ test oo-11.6.3 {
} -result 0 -cleanup {
}
+
test oo-11.6.4 {
OO: cleanup ReleaseClassContents() where class is mixed into one of its
instances
@@ -1754,6 +1755,37 @@ test oo-11.6.4 {
rename obj1 {}
}
+
+test oo-11.7 {
+ When an object is deleted its namespace is deleted, and all objects it is
+ mixed into are also deleted. If the object has been renamed into the
+ namespace of one of the objects it has been mixed into, the routine for the
+ object might get entirely deleted before the namespace of the object is
+ entirely deleted, in which case the C routine the performs the namespace
+ either must either understand that the handle on the routine for the object
+ might now be gone, or it must be guaranteed that the handle does not
+ disappear until that routine is finished.
+} -setup {
+} -body {
+ oo::define oo::class {
+ export createWithNamespace
+ }
+ oo::class create class1
+
+ oo::object create obj1
+ oo::objdefine obj1 {
+ mixin ::class1
+ }
+ set obj1ns [info object namespace obj1]
+ set class1ns [info object namespace class1]
+ rename class1 ${obj1ns}::class1
+ # No segmentation fault
+ namespace delete $class1ns
+} -cleanup {
+ rename obj {}
+} -result done
+
+
test oo-12.1 {OO: filters} {
oo::class create Aclass
Aclass create Aobject
@@ -1777,6 +1809,8 @@ test oo-12.1 {OO: filters} {
Aclass destroy
return $result
} {{calling ::Aobject->logFilter 1 2 3 4 5} 1 2 3 4 5 result=12345 12345}
+
+
test oo-12.2 {OO: filters} -setup {
oo::class create Aclass
Aclass create Aobject
@@ -4376,12 +4410,13 @@ test oo-35.6 {
} -body {
rename obj2 {}
rename obj1 {}
- # doesn't crash
+ # No segmentation fault
return done
} -cleanup {
rename obj {}
} -result done
+
test oo-36.1 {TIP #470: introspection within oo::define} {
oo::define oo::object self
} ::oo::object