Separate helper code in parser_test.go