Further refactoring of tests and ASTQuery.