bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] test-framework-sh: Improve returns_ example.


From: Bernhard Voelker
Subject: [PATCH] test-framework-sh: Improve returns_ example.
Date: Sun, 4 Aug 2024 18:22:58 +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     | 9 +++++++++
 tests/init.sh | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 779e593a14..8e21997d6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-04  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-08-03  Bruno Haible  <bruno@clisp.org>

        gnulib-tool.py: Small refactoring.
diff --git a/tests/init.sh b/tests/init.sh
index d33ef61788..3bd1e3b9cd 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -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
--
2.45.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]