Add test of apply nested function