add leak check to the arbitrary function test
test closure without arguments
reduce redundancy in test code