Replace anon sub with named sub in tests