From 8f126edc167f035c6f9b9fd7607e7dfa77f33e60 Mon Sep 17 00:00:00 2001 From: William Pursell Date: Sun, 12 Oct 2008 21:51:18 +0200 Subject: [PATCH] Fix grammar w.r.t. plurals in test reports. * lib/am/check.am: Fix singular/plural forms in test reports. * tests/check10.test: New test. * tests/Makefile.am: Update. Signed-off-by: Ralf Wildenhues --- ChangeLog | 8 ++++ lib/Automake/tests/Makefile.in | 23 +++++++-- lib/am/check.am | 23 +++++++-- tests/Makefile.am | 1 + tests/Makefile.in | 24 ++++++++-- tests/check10.test | 87 ++++++++++++++++++++++++++++++++++ 6 files changed, 151 insertions(+), 15 deletions(-) create mode 100755 tests/check10.test diff --git a/ChangeLog b/ChangeLog index cff858f78..d2cfdbc87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-12 William Pursell + Ralf Wildenhues + + Fix grammar w.r.t. plurals in test reports. + * lib/am/check.am: Fix singular/plural forms in test reports. + * tests/check10.test: New test. + * tests/Makefile.am: Update. + 2008-10-08 Ralf Wildenhues Require texi2dvi in tests, makeinfo may not be enough. diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 43bbe90ed..2c52e8209 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -239,23 +239,36 @@ check-TESTS: $(TESTS) fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ + banner="$$All$$all $$tests passed"; \ else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ + banner="$$failed of $$all $$tests failed"; \ else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ diff --git a/lib/am/check.am b/lib/am/check.am index daae5a223..ca400fef2 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -86,24 +86,37 @@ check-TESTS: $(TESTS) echo "$${col}$$res$${std}: $$tst"; \ done; \ ## Prepare the banner + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ + banner="$$All$$all $$tests passed"; \ else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ + banner="$$failed of $$all $$tests failed"; \ else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ ## DASHES should contain the largest line of the banner. dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 7f9ff9f9f..cc95743d4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -96,6 +96,7 @@ check6.test \ check7.test \ check8.test \ check9.test \ +check10.test \ checkall.test \ clean.test \ clean2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 5ceb18ff1..9eec0166f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -248,6 +248,7 @@ check6.test \ check7.test \ check8.test \ check9.test \ +check10.test \ checkall.test \ clean.test \ clean2.test \ @@ -898,23 +899,36 @@ check-TESTS: $(TESTS) fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ + banner="$$All$$all $$tests passed"; \ else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ + banner="$$failed of $$all $$tests failed"; \ else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ diff --git a/tests/check10.test b/tests/check10.test new file mode 100755 index 000000000..c817dcbe2 --- /dev/null +++ b/tests/check10.test @@ -0,0 +1,87 @@ +#! /bin/sh +# Copyright (C) 2008 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, 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 . + +# Check singular and plural in test summaries. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_OUTPUT +END + +cat > Makefile.am << 'END' +TESTS = fail pass skip xfail xpass fail2 pass2 skip2 xfail2 xpass2 +XFAIL_TESTS = xfail xpass xfail2 xpass2 +END + +cat >>pass <<'END' +#! /bin/sh +exit 0 +END +cat >>fail <<'END' +#! /bin/sh +exit 1 +END +cat >>skip <<'END' +#! /bin/sh +exit 77 +END +chmod a+x pass fail skip +cp pass pass2 +cp pass xpass +cp xpass xpass2 +cp fail xfail +cp fail fail2 +cp xfail xfail2 +cp skip skip2 + +$ACLOCAL +$AUTOCONF +$AUTOMAKE + +unset TESTS || : + +./configure +( + # Do not check for failure in this subshell + set +e + env TESTS=pass $MAKE -e check + env TESTS=fail $MAKE -e check + env TESTS=skip $MAKE -e check + env TESTS=xfail $MAKE -e check + env TESTS=xpass $MAKE -e check + env TESTS="pass pass2" $MAKE -e check + env TESTS="fail fail2" $MAKE -e check + env TESTS="skip skip2" $MAKE -e check + env TESTS="xfail xfail2" $MAKE -e check + env TESTS="xpass xpass2" $MAKE -e check + env TESTS='pass skip xfail' $MAKE -e check + $MAKE check +) >stdout +cat stdout + +grep '1 [tT]ests' stdout && Exit 1 +grep '^[^1]* [tT]est ' stdout && Exit 1 +grep '1 .* were ' stdout && Exit 1 +grep '^[^1]* was' stdout && Exit 1 +grep 'All 1 ' stdout && Exit 1 +grep '^ .*[tT]est' stdout && Exit 1 +$EGREP '1 (un)?expected (failures|passes)' stdout && Exit 1 +$EGREP '[^1] (un)?expected (failure|pass)\)' stdout && Exit 1 + +: -- 2.47.2