1 # Checking Push Parsing. -*- Autotest -*-
2 # Copyright (C) 2007 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 AT_BANNER([[Push Parsing Tests]])
21 ## ---------------------------------------------- ##
22 ## Push Parsing: Memory Leak for Early Deletion. ##
23 ## ---------------------------------------------- ##
25 AT_SETUP([[Push Parsing: Memory Leak for Early Deletion]])
29 AT_DATA_GRAMMAR([[input.y]],
35 void yyerror (char const *msg);
38 %pure-parser %push-parser
47 yyerror (char const *msg)
49 fprintf (stderr, "%s\n", msg);
57 /* Make sure we don't try to free ps->yyss in this case. */
61 /* yypstate_delete used to leak ps->yyss if the stack was reallocated but the
62 parse did not return on success, syntax error, or memory exhaustion. */
64 assert (yypush_parse (ps, 'a', NULL) == YYPUSH_MORE);
68 assert (yypush_parse (ps, 'a', NULL) == YYPUSH_MORE);
69 assert (yypush_parse (ps, 'b', NULL) == YYPUSH_MORE);
76 AT_CHECK([[bison -o input.c input.y]])
78 AT_PARSER_CHECK([[./input]])