From 6893788d4797796817e7f90a6479fecd1ddebcac Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 14 Nov 2009 21:52:34 +0100 Subject: [PATCH] Coverage for conditional `else' and `endif' arguments. * tests/cond46.test: New test. * tests/Makefile.am: Update. Signed-off-by: Ralf Wildenhues --- ChangeLog | 6 +++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/cond46.test | 110 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100755 tests/cond46.test diff --git a/ChangeLog b/ChangeLog index de8d22efb..9b514838b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-14 Ralf Wildenhues + + Coverage for conditional `else' and `endif' arguments. + * tests/cond46.test: New test. + * tests/Makefile.am: Update. + 2009-10-18 Ralf Wildenhues Simplify Variable::_check_ambiguous_condition. diff --git a/tests/Makefile.am b/tests/Makefile.am index 98829c9ac..6d42996cf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -187,6 +187,7 @@ cond42.test \ cond43.test \ cond44.test \ cond45.test \ +cond46.test \ condd.test \ condhook.test \ condinc.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index d12b8504d..7ac0b620e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -421,6 +421,7 @@ cond42.test \ cond43.test \ cond44.test \ cond45.test \ +cond46.test \ condd.test \ condhook.test \ condinc.test \ diff --git a/tests/cond46.test b/tests/cond46.test new file mode 100755 index 000000000..73b6e9416 --- /dev/null +++ b/tests/cond46.test @@ -0,0 +1,110 @@ +#! /bin/sh +# Copyright (C) 2009 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 . + +# Ensure the right condition is listed after `else' and `endif'. + +. ./defs || Exit 1 + +cat >> configure.in << 'END' +AM_CONDITIONAL([USE_A],[test x = y]) +AM_CONDITIONAL([USE_B],[test x = z]) +AC_OUTPUT +END + +$ACLOCAL + +cat > Makefile.am << 'END' +if USE_A +endif !USE_A +END + +AUTOMAKE_fails +grep 'endif.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +endif USE_B +END + +AUTOMAKE_fails +grep 'endif.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +else +endif USE_A +END + +AUTOMAKE_fails +grep 'endif.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +else +endif !USE_A +END + +$AUTOMAKE + +cat > Makefile.am << 'END' +if USE_A +if USE_B +else +endif !USE_A +endif +END + +AUTOMAKE_fails +grep 'endif.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +else USE_A +endif +END + +AUTOMAKE_fails +grep 'else.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +else USE_B +endif +END + +AUTOMAKE_fails +grep 'else.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +if USE_B +else USE_A +endif +endif +END + +AUTOMAKE_fails +grep 'else.*incompatible with current conditional' stderr + +cat > Makefile.am << 'END' +if USE_A +else !USE_A +endif +END + +$AUTOMAKE + +Exit 0 -- 2.47.2