threads / patch / 24447

patcht/{t5541,lib-httpd}: replace problematic '!()' notation with test_must_fail

Subject: [PATCH] t/{t5541,lib-httpd}: replace problematic '!()' notation with test_must_fail

## tl;dr

2 messages between Jul 20, 2010 and Jul 20, 2010. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Brandon Casey· Jul 20, 2010, 18:27 UTC · lore
From: Brandon Casey <drafnel@gmail.com>

The '!()' notation is interpreted as a pattern-list on Ksh. The Ksh man page describe it as follows:

   !(pattern-list)
      Matches anything except one of the given patterns.

Ksh performs a file glob using the pattern-list and then tries to execute the first file in the list. If a space is added between the '!' and the open parens, then Ksh will not interpret it as a pattern list, but in this case, it is preferred to use test_must_fail, so lets do so.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 t/lib-httpd.sh       |    2 +-
 t/t5541-http-push.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Show changes to 2 files +2 −2

t/lib-httpd.sh, t/t5541-http-push.sh

diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 71effc5..e733f65 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -145,7 +145,7 @@ test_http_push_nonff() {
 		echo "changed" > path2 &&
 		git commit -a -m path2 --amend &&
 
-		!(git push -v origin >output 2>&1) &&
+		test_must_fail git push -v origin >output 2>&1 &&
 		(cd "$REMOTE_REPO" &&
 		 test $HEAD = $(git rev-parse --verify HEAD))
 	'
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index 504884b..b0c2a2c 100755
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
@@ -128,7 +128,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
 
 	# push master too; this ensures there is at least one '"'push'"' command to
 	# the remote helper and triggers interaction with the helper.
-	!(git push -v origin +master master:retsam >output 2>&1) &&
+	test_must_fail git push -v origin +master master:retsam >output 2>&1 &&
 
 	grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
 	grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&
-- 
1.6.6.2
Junio C Hamano· Jul 20, 2010, 18:38 UTC · re: Brandon Casey · lore

Re: [PATCH] t/{t5541,lib-httpd}: replace problematic '!()' notation with test_must_fail

Brandon Casey <casey@nrlssc.navy.mil> writes:
> From: Brandon Casey <drafnel@gmail.com>
>
> The '!()' notation is interpreted as a pattern-list on Ksh.
Thanks.

← back to recent threads