From 88046e40d598e7e9a2f0827b187087fd65173a48 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Sun, 4 Aug 2024 18:12:16 +0200 Subject: [PATCH] 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. --- ChangeLog | 9 +++++++++ tests/init.sh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6fcb892b51..6522c546c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-08-05 Bernhard Voelker + + 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 vaszprintf-posix tests: Fix a gcc warning. 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.39.5