git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test_must_fail: compare exit_code using integer -eq operator

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Nov 25, 2015, 22:05 UTC
Message-ID
<565630A4.7070205@ramsayjones.plus.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Jeff,
Can we squash this into your fixup?

ATB, Ramsay Jones

 t/test-lib-functions.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 85aeaf9..2bb639e 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -605,22 +605,22 @@ test_must_fail () {
 	esac
 	"$@"
 	exit_code=$?
-	if test $exit_code = 0 && ! test_list_contains "$_test_ok" success
+	if test $exit_code -eq 0 && ! test_list_contains "$_test_ok" success
 	then
 		echo >&2 "test_must_fail: command succeeded: $*"
 		return 1
-	elif test $exit_code = 141 && test_list_contains "$_test_ok" sigpipe
+	elif test $exit_code -eq 141 && test_list_contains "$_test_ok" sigpipe
 	then
 		return 0
 	elif test $exit_code -gt 129 && test $exit_code -le 192
 	then
 		echo >&2 "test_must_fail: died by signal: $*"
 		return 1
-	elif test $exit_code = 127
+	elif test $exit_code -eq 127
 	then
 		echo >&2 "test_must_fail: command not found: $*"
 		return 1
-	elif test $exit_code = 126
+	elif test $exit_code -eq 126
 	then
 		echo >&2 "test_must_fail: valgrind error: $*"
 		return 1
-- 
2.6.0
Next: Jeff King
Message 1 of 2 in “test_must_fail: compare exit_code using integer -eq operator”
  1. test_must_fail: compare exit_code using integer -eq operatorRamsay Jones, Nov 25, 2015
  2. Jeff KingNov 28, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.