 : callback-throws ( -- x )
     int { } cdecl [ "Hi" throw ] alien-callback ;
 
-{ t } [ callback-throws alien? ] unit-test-with-destructors
+{ t } [
+    callback-throws [ alien? ] with-callback
+] unit-test
 
 : callback-1 ( -- callback ) void { } cdecl [ ] alien-callback ;
 
 [ 0 1 ] [ [ callback-1 ] infer [ in>> length ] [ out>> length ] bi ] unit-test
 
-{ t } [ callback-1 alien? ] unit-test-with-destructors
+{ t } [ callback-1 [ alien? ] with-callback ] unit-test
 
 : callback_test_1 ( ptr -- ) void { } cdecl alien-indirect ;
 
-{ } [ callback-1 callback_test_1 ] unit-test-with-destructors
+{ } [ callback-1 [ callback_test_1 ] with-callback ] unit-test
 
 : callback-2 ( -- callback ) void { } cdecl [ [ 5 throw ] ignore-errors ] alien-callback ;
 
-{ } [ callback-2 callback_test_1 ] unit-test-with-destructors
+{ } [ callback-2 [ callback_test_1 ] with-callback ] unit-test
 
 : callback-3 ( -- callback ) void { } cdecl [ 5 "x" set ] alien-callback ;
 
 { t 3 5 } [
     [
         namestack*
-        3 "x" set callback-3 callback_test_1
+        3 "x" set callback-3 [ callback_test_1 ] with-callback
         namestack* eq?
         "x" get "x" get-global
     ] with-scope
-] unit-test-with-destructors
+] unit-test
 
 : callback-5 ( -- callback )
     void { } cdecl [ gc ] alien-callback ;
 
 { "testing" } [
-    "testing" callback-5 callback_test_1
-] unit-test-with-destructors
+    "testing" callback-5 [ callback_test_1 ] with-callback
+] unit-test
 
 : callback-5b ( -- callback )
     void { } cdecl [ compact-gc ] alien-callback ;
 
 [ "testing" ] [
-    "testing" callback-5b callback_test_1
-] unit-test-with-destructors
+    "testing" callback-5b [ callback_test_1 ] with-callback
+] unit-test
 
 : callback-6 ( -- callback )
     void { } cdecl [ [ continue ] callcc0 ] alien-callback ;
 
 [ 1 2 3 ] [
-    callback-6 callback_test_1 1 2 3
-] unit-test-with-destructors
+    callback-6 [ callback_test_1 1 2 3 ] with-callback
+] unit-test
 
 : callback-7 ( -- callback )
     void { } cdecl [ 1000000 sleep ] alien-callback ;
 
-[ 1 2 3 ] [ callback-7 callback_test_1 1 2 3 ] unit-test-with-destructors
+[ 1 2 3 ] [ callback-7 [ callback_test_1 1 2 3 ] with-callback ] unit-test
 
 [ f ] [ namespace global eq? ] unit-test
 
 : callback-8 ( -- callback )
     void { } cdecl [ [ ] in-thread yield ] alien-callback ;
 
-[ ] [ callback-8 callback_test_1 ] unit-test-with-destructors
+[ ] [ callback-8 [ callback_test_1 ] with-callback ] unit-test
 
 : callback-9 ( -- callback )
     int { int int int } cdecl [

[ T{ some-tuple f 5.0 } ] [
    [
        some-tuple new
        aa-callback-1
        aa-indirect-1 >>x
    ] compile-call
] unit-test-with-destructors

! GC maps regression
: anton's-regression ( -- )

    test_struct_14 { double double } cdecl alien-indirect ;

{ 1.0 2.0 } [
    1.0 2.0 callback-10 [
        callback-10-test [ x1>> ] [ x2>> ] bi
    ] with-callback
] unit-test

FUNCTION: test-struct-12 ffi_test_41 ( int a, double x ) ;

