# Checking diagnotics. -*- Autotest -*-
# Copyright (C) 2019 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 3 of the License, 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, see .
AT_BANNER([[Diagnostics.]])
# AT_TEST([TITLE], [GRAMMAR], [OUTPUT-WITH-STYLE])
m4_pushdef([AT_TEST],
[
AT_SETUP([$1])
AT_KEYWORDS([diagnostics])
AT_BISON_OPTION_PUSHDEFS
AT_DATA_GRAMMAR([[input.y]], [$2])
AT_DATA([experr], [$3])
AT_BISON_CHECK([-fcaret --style=debug -Wother input.y], [], [], [experr])
# When no style, same messages, except the style.
AT_CHECK([perl -pi -e 's{?\w+>}{}g' experr])
AT_BISON_CHECK([-fcaret -Wother input.y], [], [], [experr])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP
])
## ---------- ##
## Warnings. ##
## ---------- ##
AT_TEST([[Warnings]],
[[%token FOO FOO FOO
%token FOO FOO FOO
%%
exp:;
]],
[[input.y:9.12-14: warning: symbol FOO redeclared [-Wother]
%token FOO FOO FOO
^~~
input.y:9.16-18: warning: symbol FOO redeclared [-Wother]
%token FOO FOO FOO
^~~
input.y:10.8-10: warning: symbol FOO redeclared [-Wother]
%token FOO FOO FOO
^~~
input.y:10.13-15: warning: symbol FOO redeclared [-Wother]
%token FOO FOO FOO
^~~
input.y:10.18-20: warning: symbol FOO redeclared [-Wother]
%token FOO FOO FOO
^~~
]])
m4_popdef([AT_TEST])