From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elijah Newren Subject: [PATCHv5 01/16] test-lib: make test_expect_code a test command Date: Sat, 2 Oct 2010 23:10:29 -0600 Message-ID: <1286082644-31595-2-git-send-email-newren@gmail.com> References: <1286082644-31595-1-git-send-email-newren@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: gitster@pobox.com, avarab@gmail.com, jrnieder@gmail.com, Elijah Newren To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sun Oct 03 07:09:22 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P2Gp6-0001s0-3C for gcvg-git-2@lo.gmane.org; Sun, 03 Oct 2010 07:09:20 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872Ab0JCFJR convert rfc822-to-quoted-printable (ORCPT ); Sun, 3 Oct 2010 01:09:17 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:55800 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746Ab0JCFJP (ORCPT ); Sun, 3 Oct 2010 01:09:15 -0400 Received: by pvg2 with SMTP id 2so1068412pvg.19 for ; Sat, 02 Oct 2010 22:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=7/ZLS1iZ+bC5t0ioe77qdP1O5qgf5p+qaOrpkL85/j0=; b=UPVwZ/arMj2Rj1rrl/cC38exSm4qkp8nqUY9TFJBT8b15KSpGj+qNWisKdUQh/Y2+b sDeD/cnChtS2vMGXyv5h92j1yTkhUA+5VPFoRVugfZwC8LaQlaywxWvWCPgqxqZiaZ4W Aj8VzGxFg67Znd5XbFmMtSP/zLfpKAPKcy09s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; b=M6nZJMsih9hN09VFItIf280gvTzN1IYZVfp9cYwAUIPheA4dcD+YsE2xx+9eb5cPWS MyNBiDMf+ORVL3pmVSZDN4MnXMDVEJ27K1FdpmisQ+hEWNYEAn3lk0JD/mTVmpJbigm2 jK1fl/SErKshJYf+Kup7zP+t/kbYpuO/NWGXA= Received: by 10.142.245.21 with SMTP id s21mr6799892wfh.329.1286082555026; Sat, 02 Oct 2010 22:09:15 -0700 (PDT) Received: from Miney.hsd1.nm.comcast.net. (c-76-113-57-218.hsd1.nm.comcast.net [76.113.57.218]) by mx.google.com with ESMTPS id o16sm4140250wfh.19.2010.10.02.22.09.12 (version=SSLv3 cipher=RC4-MD5); Sat, 02 Oct 2010 22:09:14 -0700 (PDT) X-Mailer: git-send-email 1.7.3.1.66.gab790 In-Reply-To: <1286082644-31595-1-git-send-email-newren@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: =46rom: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason Change test_expect_code to be a normal test command instead of a top-level command. As a top-level command it would fail in cases like: test_expect_code 1 'phoney' ' foo && bar && (exit 1) ' Here the test might incorrectly succeed if "foo" or "bar" happened to fail with exit status 1. Instead we now do: test_expect_success 'phoney' ' foo && bar && test_expect_code 1 "(exit 1)" ' Which will only succeed if "foo" and "bar" return status 0, and "(exit 1)" returns status 1. Some test code in t0000-basic.sh relied on the old semantics of test_expect_code to test the test_when_finished command. I've converted that code to use an external test similar no the TODO test I added in v1.7.3-rc0~2^2~3. Signed-off-by: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason Signed-off-by: Elijah Newren --- No changes from =C3=86var's submission; I just pulled it into this patc= h series since it's not in pu yet and I wanted to depend on it. t/README | 16 +++++++------ t/t0000-basic.sh | 55 ++++++++++++++++++++++++++++++++++++++-= ------- t/t1504-ceiling-dirs.sh | 5 ++- t/t6020-merge-df.sh | 4 ++- t/test-lib.sh | 40 ++++++++++++++++++--------------- 5 files changed, 82 insertions(+), 38 deletions(-) diff --git a/t/README b/t/README index a1eb7c8..c216e8c 100644 --- a/t/README +++ b/t/README @@ -395,13 +395,6 @@ library for your script to use. Like test_expect_success this function can optionally use a three argument invocation with a prerequisite as the first argument. =20 - - test_expect_code []