Files
bison/tests/output.at
Akim Demaille d63e24071f * tests/atgeneral.m4, tests/atconfig.in, tests/suite.at: Remove.
* m4/atconfig.m4: Remove.
* tests/testsuite.at, tests/atlocal.in, tests/output.at,
* tests/bison: New.
* tests/regression.at, tests/calc.at: Use m4_define, AT_BANNER,
m4_if, m4_patsubst, and m4_regexp.
* tests/calc.at (_AT_CHECK_CALC, _AT_CHECK_CALC_ERROR): Use an
`input' file instead of echo.
2001-08-30 15:36:37 +00:00

104 lines
3.2 KiB
Plaintext

# Checking the output filenames. -*- Autotest -*-
# Copyright 2000, 2001 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AT_BANNER([[Output file names.]])
# AT_CHECK_BISON_FLAGS(FLAGS, EXPECTED-FILES-SORTED)
# --------------------------------------------------
m4_define([AT_CHECK_BISON_FLAGS],
[AT_SETUP([Output files: $1.])
AT_DATA([foo.y],
[[%%
foo: {}
]])
rm -rf $2
AT_CHECK([bison -dv foo.y $1], 0, ignore, ignore)
AT_CHECK([ls $2 | sort | tr '\n' ' ' | sed 's/.$//g'], 0, [$2])
rm -f $2
AT_CLEANUP
])
AT_CHECK_BISON_FLAGS([], [foo.output foo.tab.c foo.tab.h])
AT_CHECK_BISON_FLAGS([-o foo.c], [foo.c foo.h foo.output])
AT_CHECK_BISON_FLAGS([-o foo.tab.c], [foo.output foo.tab.c foo.tab.h])
AT_CHECK_BISON_FLAGS([-y], [y.output y.tab.c y.tab.h])
AT_CHECK_BISON_FLAGS([-b bar], [bar.output bar.tab.c bar.tab.h])
AT_CHECK_BISON_FLAGS([-g -o foo.c], [foo.c foo.h foo.output foo.vcg])
# AT_CHECK_BISON_PERCENT(GRAMMAR-OPTIONS, EXPECTED-FILES-SORTED)
# --------------------------------------------------------------
m4_define([AT_CHECK_BISON_PERCENT],
[AT_SETUP([Output files: $1.])
AT_DATA([foo.y],
[[$1
%defines
%verbose
%%
foo: {}
]])
rm -rf $2
AT_CHECK([bison foo.y], 0, ignore, ignore)
AT_CHECK([ls $2 | sort | tr '\n' ' ' | sed 's/.$//g'], 0, [$2])
rm -f $2
AT_CLEANUP
])
# The sames, but using the % directives.
AT_CHECK_BISON_PERCENT([], [foo.output foo.tab.c foo.tab.h])
# AT_CHECK_BISON_PERCENT([%output foo.c], [foo.c foo.h foo.output])
# AT_CHECK_BISON_PERCENT([%output foo.tab.c], [foo.output foo.tab.c foo.tab.h])
AT_CHECK_BISON_PERCENT([%yacc], [y.output y.tab.c y.tab.h])
# AT_CHECK_BISON_PERCENT([%file_prefix bar], [bar.output bar.tab.c bar.tab.h])
# AT_CHECK_BISON_PERCENT_FLAGS(GRAMMAR_OPTIONS, FLAGS, EXPECTED-FILES-SORTED)
# ---------------------------------------------------------------------------
m4_define([AT_CHECK_BISON_PERCENT_FLAGS],
[AT_SETUP([Output files: $1.])
AT_DATA([foo.yy],
[[$1
%defines
%verbose
%%
foo: {}
]])
rm -rf $3
AT_CHECK([bison foo.yy $2], 0, ignore, ignore)
AT_CHECK([ls $3 | sort | tr '\n' ' ' | sed 's/.$//g'], 0, [$3])
rm -f $3
AT_CLEANUP
])
# Check priorities of extension control.
AT_CHECK_BISON_PERCENT_FLAGS(
[],
[],
[foo.output foo.tab.cc foo.tab.hh])
AT_CHECK_BISON_PERCENT_FLAGS(
[],
[-o foo.c],
[foo.c foo.h foo.output])
AT_CHECK_BISON_PERCENT_FLAGS(
[%source_extension ".cpp"] [%header_extension ".hhh"],
[],
[foo.output foo.tab.cpp foo.tab.hhh])
AT_CHECK_BISON_PERCENT_FLAGS(
[%source_extension ".cc"] [%header_extension ".hh"],
[-o foo.c],
[foo.c foo.h foo.output])