git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t/t3700: convert two uses of negation operator '!' to use test_must_fail
@ 2010-07-20 15:24 Brandon Casey
  2010-07-20 15:55 ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 40+ messages in thread
From: Brandon Casey @ 2010-07-20 15:24 UTC (permalink / raw)
  To: gitster; +Cc: git, Jens.Lehmann, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

These two lines use the negation '!' operator to negate the result of a
simple command.  Since these commands do not contain any pipes or other
complexities, the test_must_fail function can be used and is preferred
since it will additionally detect termination due to a signal.

This was noticed because the second use of '!' does not include a space
between the '!' and the opening parens.  Ksh interprets this 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/t3700-add.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 47fbf53..d03495d 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -268,7 +268,7 @@ test_expect_success 'git add --dry-run of existing changed file' "
 
 test_expect_success 'git add --dry-run of non-existing file' "
 	echo ignored-file >>.gitignore &&
-	! (git add --dry-run track-this ignored-file >actual 2>&1) &&
+	test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 &&
 	echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
 "
 
@@ -281,7 +281,7 @@ add 'track-this'
 EOF
 
 test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
-	!(git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1) &&
+	test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1 &&
 	test_cmp expect actual
 '
 
-- 
1.6.6.2

^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2010-07-22 18:22 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 15:24 [PATCH] t/t3700: convert two uses of negation operator '!' to use test_must_fail Brandon Casey
2010-07-20 15:55 ` Ævar Arnfjörð Bjarmason
2010-07-20 16:32   ` Brandon Casey
2010-07-20 16:38     ` Jared Hance
2010-07-20 17:17       ` [PATCH] t/README: clarify test_must_fail description Brandon Casey
2010-07-20 18:00         ` Junio C Hamano
2010-07-20 18:06           ` Ævar Arnfjörð Bjarmason
2010-07-20 18:14             ` Jared Hance
2010-07-20 19:09               ` [PATCH] Convert "! git" to "test_must_fail" git Jared Hance
2010-07-20 19:42                 ` Brandon Casey
2010-07-20 19:48                   ` Jonathan Nieder
2010-07-20 19:59                     ` Brandon Casey
2010-07-20 23:18                   ` [PATCH v2] Convert "! git" to "test_must_fail git" Jared Hance
2010-07-20 18:34             ` [PATCH] t/README: clarify test_must_fail description Junio C Hamano
2010-07-20 18:43               ` Ævar Arnfjörð Bjarmason
2010-07-20 19:16                 ` Jonathan Nieder
2010-07-20 20:49                   ` Ævar Arnfjörð Bjarmason
2010-07-20 21:12                     ` Brandon Casey
2010-07-20 21:25                       ` Ævar Arnfjörð Bjarmason
2010-07-20 21:55                       ` [PATCH] t/: work around one-shot variable assignment with test_must_fail Brandon Casey
2010-07-20 23:19                         ` Erick Mattos
     [not found]                           ` <20100721000823.GD4282@burratino>
     [not found]                             ` <AANLkTinlXsbp0NdhmqvlrmBBqGuGOIkh6PzGYFnk05qv@mail.gmail.com>
     [not found]                               ` <20100721141140.GA12123@burratino>
     [not found]                                 ` <AANLkTinhyFD4RhLLxS-jj-oX5VWqGyy7AiXJ3VJlcU2W@mail.gmail.com>
2010-07-21 15:23                                   ` [PATCH] gitweb: clarify search results page when no matching commit found Jonathan Nieder
2010-07-21 17:51                                     ` Jakub Narebski
2010-07-21 19:50                                       ` [PATCH v2] " Jonathan Nieder
2010-07-21 15:32                           ` [PATCH] t/: work around one-shot variable assignment with test_must_fail Brandon Casey
2010-07-22  0:28                             ` Erick Mattos
2010-07-20 23:44                         ` Ævar Arnfjörð Bjarmason
2010-07-20 23:45                           ` Ævar Arnfjörð Bjarmason
2010-07-21  0:01                           ` Jonathan Nieder
2010-07-21  0:09                             ` Ævar Arnfjörð Bjarmason
2010-07-21  0:14                               ` Jonathan Nieder
2010-07-21  0:34                                 ` Ævar Arnfjörð Bjarmason
2010-07-21  1:05                                   ` git name-rev for fun and profit (Re: [PATCH] t/: work around one-shot variable assignment with test_must_fail) Jonathan Nieder
2010-07-21 11:32                                     ` Ævar Arnfjörð Bjarmason
2010-07-21 19:29                         ` [PATCH] t/: work around one-shot variable assignment with test_must_fail Junio C Hamano
2010-07-22  0:32                           ` Erick Mattos
2010-07-22 18:21                           ` Brandon Casey
2010-07-20 18:19           ` [PATCH] t/README: clarify test_must_fail description Brandon Casey
2010-07-20 17:52       ` [PATCH] t/t3700: convert two uses of negation operator '!' to use test_must_fail Ævar Arnfjörð Bjarmason
2010-07-20 18:25     ` Ævar Arnfjörð Bjarmason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).