Add test to ensure the anonymous range iterator optimization fires