From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: [PATCH] t/t3800: do not use a temporary file to hold expected result. Date: Fri, 04 Jan 2008 22:48:12 -0800 Message-ID: <7vbq80g443.fsf@gitster.siamese.dyndns.org> References: <1199506008-12225-1-git-send-email-vmiklos@frugalware.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org To: Miklos Vajna X-From: git-owner@vger.kernel.org Sat Jan 05 07:48:55 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1JB2py-0007ne-FE for gcvg-git-2@gmane.org; Sat, 05 Jan 2008 07:48:55 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752191AbYAEGsZ (ORCPT ); Sat, 5 Jan 2008 01:48:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752141AbYAEGsZ (ORCPT ); Sat, 5 Jan 2008 01:48:25 -0500 Received: from a-sasl-quonix.sasl.smtp.pobox.com ([208.72.237.25]:45701 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752123AbYAEGsY (ORCPT ); Sat, 5 Jan 2008 01:48:24 -0500 Received: from a-sasl-quonix (localhost [127.0.0.1]) by a-sasl-quonix.pobox.com (Postfix) with ESMTP id 4F39D64F2; Sat, 5 Jan 2008 01:48:23 -0500 (EST) Received: from pobox.com (ip68-225-240-77.oc.oc.cox.net [68.225.240.77]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-quonix.pobox.com (Postfix) with ESMTP id 27F2D64F1; Sat, 5 Jan 2008 01:48:19 -0500 (EST) In-Reply-To: <1199506008-12225-1-git-send-email-vmiklos@frugalware.org> (Miklos Vajna's message of "Sat, 5 Jan 2008 05:06:48 +0100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: It is a good practice to write program output to a temporary file during the test, as it would allow easier postmortem when the tested program does break. But there is no benefit in writing the expected output out to the temporary. This actually fixes a bug in check_verify_failure() routine. The intention of the test seems to make sure the "git mktag" command fails, and it spits out the expected error message. But if the command did not fail as expected, the shell function as originally written would not have detected the failure. Signed-off-by: Junio C Hamano --- t/t3800-mktag.sh | 89 +++++++++++++++-------------------------------------- 1 files changed, 25 insertions(+), 64 deletions(-) diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index e5f3073..f280320 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -12,10 +12,11 @@ test_description='git-mktag: tag object verify test' # given in the expect.pat file. check_verify_failure () { - test_expect_success \ - "$1" \ - 'git-mktag message || - egrep -q -f expect.pat message' + expect="$2" + test_expect_success "$1" ' + ( ! git-mktag message ) && + grep -q "$expect" message + ' } ########################################################### @@ -33,11 +34,8 @@ cat >tag.sig <expect.pat <expect.pat <expect.pat <expect.pat <tag.sig printf "type tagsssssssssssssssssssssssssssssss" >>tag.sig -cat >expect.pat <expect.pat <expect.pat <expect.pat <expect.pat <expect.pat <expect.pat <expect.pat <