testNoAlloc

Verifies that call to expr does not allocate GC memory

This is achieved by checking GC usage stats before and after the call.

void
testNoAlloc
(
lazy void expr
,
istring file = __FILE__
,
int line = __LINE__
)

Parameters

expr void

any expression, wrapped in void-returning delegate if necessary

file istring

file where test is invoked

line int

line where test is invoked

Throws

TestException if unexpected allocation happens

Examples

testNoAlloc({} ());

testThrown!(TestException)(
    testNoAlloc({ auto x = new int; } ())
);

Meta