1 # Checking skeleton support. -*- 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([[Skeleton Support.]])
21 ## ------------------------------ ##
22 ## relative skeleton file names. ##
23 ## ------------------------------ ##
25 AT_SETUP([[relative skeleton file names]])
27 AT_CHECK([[mkdir tmp]])
29 AT_DATA([[tmp/skel.c]],
30 [[m4@&t@_divert_push(0)d@&t@nl
31 @output(b4_parser_file_name@)d@&t@nl
32 b4_percent_define_get([[test]])
37 [[m4@&t@_divert_push(0)d@&t@nl
38 @output(b4_parser_file_name@)d@&t@nl
39 b4_percent_define_get([[test]]) -- Local
43 AT_DATA([[tmp/input-gram.y]],
44 [[%skeleton "./skel.c"
45 %define test "Hello World"
50 AT_DATA([[input-gram.y]],
51 [[%skeleton "./skel.c"
52 %define test "Hello World"
57 AT_DATA([[tmp/input-cmd-line.y]],
58 [[%define test "Hello World"
63 AT_CHECK([[bison tmp/input-gram.y]])
64 AT_CHECK([[cat input-gram.tab.c]], [[0]],
68 AT_CHECK([[bison input-gram.y]])
69 AT_CHECK([[cat input-gram.tab.c]], [[0]],
70 [[Hello World -- Local
73 AT_CHECK([[bison --skeleton=tmp/skel.c tmp/input-cmd-line.y]])
74 AT_CHECK([[cat input-cmd-line.tab.c]], [[0]],
81 ## ------------------------------- ##
82 ## installed skeleton file names. ##
83 ## ------------------------------- ##
85 AT_SETUP([[installed skeleton file names]])
90 void yyerror (char const *msg);
104 yyerror (char const *msg)
106 fprintf (stderr, "%s\n", msg);
122 AT_DATA([[input-cmd-line.y]],
125 AT_DATA([[input-gram.y]],
126 [[%skeleton "yacc.c"]
129 AT_CHECK([[bison --skeleton=yacc.c -o input-cmd-line.c input-cmd-line.y]])
130 AT_COMPILE([[input-cmd-line]])
131 AT_PARSER_CHECK([[./input-cmd-line]], [[1]], [],
132 [[syntax error, unexpected 'a', expecting $end
135 AT_CHECK([[bison -o input-gram.c input-gram.y]])
136 AT_COMPILE([[input-gram]])
137 AT_PARSER_CHECK([[./input-gram]], [[1]], [],
138 [[syntax error, unexpected 'a', expecting $end