Skip to content

Commit

Permalink
add unit test 229 to verify spork dangling refs
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Oct 26, 2023
1 parent 8382116 commit 8a67346
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/test/01-Basic/229-dangle-ref-spork.ck
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// verify no dangling reference with sporked
// functions that return Objects

Object foo;

// function that returns an Object
fun Object get()
{
return foo;
}

// spork
spork ~ get();

// give sporked function a chance to run
10::ms => now;

// check reference count
if( Machine.refcount(foo) == 1 ) <<< "success" >>>;

0 comments on commit 8a67346

Please sign in to comment.