]> Savannah Git Hosting - gnulib.git/commitdiff
test-framework-sh: Improve returns_ example.
authorBernhard Voelker <mail@bernhard-voelker.de>
Sun, 4 Aug 2024 16:12:16 +0000 (18:12 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 12 Aug 2024 16:13:12 +0000 (18:13 +0200)
In the shell test framework, an error is either flagged by setting
the shell variable fail=1, or by invoking the fail_ function with an
error diagnostic.

* tests/init.sh (returns_): Change example code in the comment to
use '|| fail=1' properly.

ChangeLog
tests/init.sh

index 6fcb892b51468830de8185784daa790b8e32ccfe..6522c546c820c019f7223164342a0f374bf1cbdd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-05  Bernhard Voelker  <mail@bernhard-voelker.de>
+
+       test-framework-sh: Improve returns_ example.
+       In the shell test framework, an error is either flagged by setting
+       the shell variable fail=1, or by invoking the fail_ function with an
+       error diagnostic.
+       * tests/init.sh (returns_): Change example code in the comment to
+       use '|| fail=1' properly.
+
 2024-07-29  Bruno Haible  <bruno@clisp.org>
 
        vaszprintf-posix tests: Fix a gcc warning.
index d33ef61788ab9c5663b4351a155537b6fe3e69d4..3bd1e3b9cd5a96cbff51913e75bcb45c7eb1e3ee 100644 (file)
@@ -595,7 +595,7 @@ fi
 # I.e., just doing `command ... &&fail=1` will not catch
 # a segfault in command for example.  With this helper you
 # instead check an explicit exit code like
-#   returns_ 1 command ... || fail
+#   returns_ 1 command ... || fail=1
 returns_ () {
   # Disable tracing so it doesn't interfere with stderr of the wrapped command
   { local is_tracing=`{ :; } 2>&1`; } 2>/dev/null