Better tests for in-criterion query function call detection.
Nasty refactoring.