Skip to content

Commit

Permalink
add unit test 228
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Oct 26, 2023
1 parent 71fcb0a commit 8382116
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/test/01-Basic/228-dangle-ref-recurse.ck
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// test dangling object cleanup on recursive functions that return Objects

// test object
Object foo;

// a recrusive function
fun Object get( int i )
{
// stop recursion
if( i == 10 ) return foo;
// calls
get(i+1), get(i+1), get(i+1);
// another call
return get(i+1);
}

// get started
get(0);

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

0 comments on commit 8382116

Please sign in to comment.