pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
2019-04-06
2019-04-06 15:05:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>
8aae365fa323cd9ca11be86eba9f3d7a48d1df37 (
33
lines) (+
33
/-
0
)
[
Show
|
Annotate
]
Branch:
master
Pike.InhibitDestruct: New API for inhibiting destruction.
1027:
]]) test_any([[
+
// Test Pike.InhibitDestruct.
class Foo {
-
+
inherit Pike.InhibitDestruct;
+
/* Make the symbols visible outside. */
+
void inhibit_destruct() { ::inhibit_destruct(); }
+
void permit_destruct() { ::permit_destruct(); }
+
}
+
object o = Foo();
+
destruct(o);
+
if (o) return 1;
+
+
o = Foo();
+
o->inhibit_destruct();
+
o->permit_destruct();
+
if (!o) return 2;
+
destruct(o);
+
if (o) return 3;
+
+
o = Foo();
+
o->inhibit_destruct();
+
destruct(o);
+
if (!o) return 4;
+
o->inhibit_destruct();
+
if (!o) return 5;
+
o->permit_destruct();
+
if (!o) return 6;
+
o->permit_destruct();
+
if (o) return 7;
+
return 0;
+
]], 0)
+
+
test_any([[
+
class Foo {
constant zero = 0; mapping(string:array(int)) m; string foo() { return sprintf("%O", typeof(m[""][zero])); }