unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH] test/test-lib.sh: execute basename(1)s lazier in test_expect_equal_file ()
Date: Sun,  9 Oct 2016 23:36:07 +0300	[thread overview]
Message-ID: <1476045367-26825-1-git-send-email-tomi.ollila@iki.fi> (raw)

Moved the 2 basename(1) executions to the test failure branch in
test_expect_equal_file ().

The output of basename(1) executions in function test_expect_equal_file ()
are only used when tests fails -- when all tests pass these 2 basename(1)
executions are no longer done at all.
---
 test/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index bda8a80..397408a 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -618,15 +618,15 @@ test_expect_equal_file ()
 	error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
 
 	file1="$1"
-	basename1=`basename "$file1"`
 	file2="$2"
-	basename2=`basename "$file2"`
 	if ! test_skip "$test_subtest_name"
 	then
 		if diff -q "$file1" "$file2" >/dev/null ; then
 			test_ok_
 		else
 			testname=$this_test.$test_count
+			basename1=`basename "$file1"`
+			basename2=`basename "$file2"`
 			cp "$file1" "$testname.$basename1"
 			cp "$file2" "$testname.$basename2"
 			test_failure_ "$(diff -u "$testname.$basename1" "$testname.$basename2")"
-- 
2.7.4

             reply	other threads:[~2016-10-09 20:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-09 20:36 Tomi Ollila [this message]
2016-10-26  1:04 ` [PATCH] test/test-lib.sh: execute basename(1)s lazier in test_expect_equal_file () David Bremner
2016-10-26 20:39   ` Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476045367-26825-1-git-send-email-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).