]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix grammar w.r.t. plurals in test reports.
authorWilliam Pursell <bill.pursell@gmail.com>
Sun, 12 Oct 2008 19:51:18 +0000 (21:51 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 12 Oct 2008 19:51:18 +0000 (21:51 +0200)
* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/Automake/tests/Makefile.in
lib/am/check.am
tests/Makefile.am
tests/Makefile.in
tests/check10.test [new file with mode: 0755]

index cff858f78890df29dd3cd6f5a2e8beab8a78a61a..d2cfdbc87d0c0fd8bd356f071f9d86e27c835bf7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-12  William Pursell <bill.pursell@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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  <Ralf.Wildenhues@gmx.de>
 
        Require texi2dvi in tests, makeinfo may not be enough.
index 43bbe90ed1d856d79ced7dd4e06b5fdf38ef33b4..2c52e82098b5c8896c06e709fa9eac33ec723330 100644 (file)
@@ -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; \
index daae5a22367a9ed6795616f8949a085477d3311c..ca400fef24d310f0d007d29f910565867e5e8c5a 100644 (file)
@@ -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; \
index 7f9ff9f9f517154c883af5d95512feca57b833b9..cc95743d4171076f4debb1a05c90ee2f87f8e91b 100644 (file)
@@ -96,6 +96,7 @@ check6.test \
 check7.test \
 check8.test \
 check9.test \
+check10.test \
 checkall.test \
 clean.test \
 clean2.test \
index 5ceb18ff1b30333d912949667d3264407bf117cc..9eec0166fd45e7b32eb7ffc440a7cd5a41dda0ad 100644 (file)
@@ -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 (executable)
index 0000000..c817dcb
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+: