1 USING: destructors kernel tools.test continuations accessors
7 M: dispose-error dispose 3 throw ;
9 TUPLE: dispose-dummy disposed? ;
11 M: dispose-dummy dispose t >>disposed? drop ;
13 T{ dispose-error } "a" set
14 T{ dispose-dummy } "b" set
16 [ f ] [ "b" get disposed?>> ] unit-test
18 [ { "a" "b" } [ get ] map dispose-each ] [ 3 = ] must-fail-with
20 [ t ] [ "b" get disposed?>> ] unit-test
22 TUPLE: dummy-obj destroyed? ;
24 : <dummy-obj> dummy-obj new ;
26 TUPLE: dummy-destructor obj ;
28 C: <dummy-destructor> dummy-destructor
30 M: dummy-destructor dispose ( obj -- )
31 obj>> t >>destroyed? drop ;
34 <dummy-destructor> &dispose drop ;
37 <dummy-destructor> |dispose drop ;
41 <dummy-obj> dup destroy-always
42 ] with-destructors destroyed?>>
47 <dummy-obj> dup destroy-later
48 ] with-destructors destroyed?>>
57 ] ignore-errors destroyed?>>
66 ] ignore-errors destroyed?>>