From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Subject: [PATCH 02/10] t/t3701-add-interactive.sh: change from skip_all=* to prereq skip Date: Fri, 13 Aug 2010 20:40:05 +0000 Message-ID: <1281732013-18284-3-git-send-email-avarab@gmail.com> References: <1281732013-18284-1-git-send-email-avarab@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Fri Aug 13 22:41:24 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 1Ok146-0007V9-4r for gcvg-git-2@lo.gmane.org; Fri, 13 Aug 2010 22:41:22 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755762Ab0HMUk6 convert rfc822-to-quoted-printable (ORCPT ); Fri, 13 Aug 2010 16:40:58 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:42436 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755767Ab0HMUky (ORCPT ); Fri, 13 Aug 2010 16:40:54 -0400 Received: by wwj40 with SMTP id 40so3432930wwj.1 for ; Fri, 13 Aug 2010 13:40:53 -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=ZVyOjWgQuobL7PVShSjvcxsGGwg1blgFXWIJDwSuT60=; b=QFyImOQ7bE/8e6ZmHxyU2fjAP/HDVHaUtvpMPn9qoW4DFnGrenooUsykhG6vipIJCY kf5VV53zVFH/+jJtqWeIfrZmGj40TC7m3Piq+ZPeTizrVYzPZy8a1jjw2q13Cg9w5cWV oXC1EB48L50UMWhHzi/AVXZw7zfaedqKLTKAw= 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=O+DN0eFdeWSpbN8du+D5x2bh3fM/pTgefVIwvho4nYQPPFlLg7qsHexy9lWBmW0YD0 WyR2B1Zt0b4Pf3gj6fmbt+wQYrRIMfX2SOlfwonrsecOSnVNyXIttlaqhWEio3rXJH/9 GfUeeNToDs30pKv/8bHf2CROnbBrNwN8MbQIY= Received: by 10.227.129.12 with SMTP id m12mr1946833wbs.102.1281732053324; Fri, 13 Aug 2010 13:40:53 -0700 (PDT) Received: from v.nix.is (v.nix.is [109.74.193.250]) by mx.google.com with ESMTPS id e8sm1838298wej.46.2010.08.13.13.40.51 (version=SSLv3 cipher=RC4-MD5); Fri, 13 Aug 2010 13:40:52 -0700 (PDT) X-Mailer: git-send-email 1.7.2.1.338.gf2379 In-Reply-To: <1281732013-18284-1-git-send-email-avarab@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Change this test to skip test with test prerequisites, and to do setup work in tests. This improves the skipped statistics on platforms where the test isn't run. Signed-off-by: =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason --- t/t3701-add-interactive.sh | 104 +++++++++++++++++++++++++++++-------= ------- 1 files changed, 70 insertions(+), 34 deletions(-) diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index 75ec90b..d6327e7 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -4,21 +4,18 @@ test_description=3D'add -i basic tests' . ./test-lib.sh . "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh =20 -if ! test_have_prereq PERL; then - skip_all=3D'skipping git add -i tests, perl not available' - test_done -fi - -test_expect_success 'setup (initial)' ' +test_expect_success PERL 'setup (initial)' ' echo content >file && git add file && echo more >>file && echo lines >>file ' -test_expect_success 'status works (initial)' ' +test_expect_success PERL 'status works (initial)' ' git add -i output && grep "+1/-0 *+2/-0 file" output ' + +test_expect_success PERL 'setup expected' ' cat >expected <output && sed -ne "/new file/,/content/p" diff && test_cmp expected diff ' -test_expect_success 'revert works (initial)' ' +test_expect_success PERL 'revert works (initial)' ' git add file && (echo r; echo 1) | git add -i && git ls-files >output && ! grep . output ' =20 -test_expect_success 'setup (commit)' ' +test_expect_success PERL 'setup (commit)' ' echo baseline >file && git add file && git commit -m commit && @@ -48,10 +47,12 @@ test_expect_success 'setup (commit)' ' echo more >>file && echo lines >>file ' -test_expect_success 'status works (commit)' ' +test_expect_success PERL 'status works (commit)' ' git add -i output && grep "+1/-0 *+2/-0 file" output ' + +test_expect_success PERL 'setup expected' ' cat >expected <output && sed -ne "/^index/,/content/p" diff && test_cmp expected diff ' -test_expect_success 'revert works (commit)' ' +test_expect_success PERL 'revert works (commit)' ' git add file && (echo r; echo 1) | git add -i && git add -i output && grep "unchanged *+3/-0 file" output ' =20 + +test_expect_success PERL 'setup expected' ' cat >expected <fake_editor.sh <fake_editor.sh < diff && test_cmp expected diff ' =20 +test_expect_success PERL 'setup patch' ' cat >patch <fake_editor.sh -cat >>fake_editor.sh <<\EOF +' + +test_expect_success PERL 'setup fake editor' ' + echo "#!$SHELL_PATH" >fake_editor.sh && + cat >>fake_editor.sh <<\EOF && mv -f "$1" oldpatch && mv -f patch "$1" EOF -chmod a+x fake_editor.sh -test_set_editor "$(pwd)/fake_editor.sh" -test_expect_success 'bad edit rejected' ' + chmod a+x fake_editor.sh && + test_set_editor "$(pwd)/fake_editor.sh" +' + +test_expect_success PERL 'bad edit rejected' ' git reset && (echo e; echo n; echo d) | git add -p >output && grep "hunk does not apply" output ' =20 +test_expect_success PERL 'setup patch' ' cat >patch <output && grep "hunk does not apply" output ' =20 +test_expect_success PERL 'setup patch' ' cat >patch <patch <expected <output && test_cmp expected output ' =20 -test_expect_success 'skip files similarly as commit -a' ' +test_expect_success PERL 'skip files similarly as commit -a' ' git reset && echo file >.gitignore && echo changed >file && @@ -153,7 +178,7 @@ test_expect_success 'skip files similarly as commit= -a' ' ' rm -f .gitignore =20 -test_expect_success FILEMODE 'patch does not affect mode' ' +test_expect_success PERL,FILEMODE 'patch does not affect mode' ' git reset --hard && echo content >>file && chmod +x file && @@ -162,7 +187,7 @@ test_expect_success FILEMODE 'patch does not affect= mode' ' git diff file | grep "new mode" ' =20 -test_expect_success FILEMODE 'stage mode but not hunk' ' +test_expect_success PERL,FILEMODE 'stage mode but not hunk' ' git reset --hard && echo content >>file && chmod +x file && @@ -172,7 +197,7 @@ test_expect_success FILEMODE 'stage mode but not hu= nk' ' ' =20 =20 -test_expect_success FILEMODE 'stage mode and hunk' ' +test_expect_success PERL,FILEMODE 'stage mode and hunk' ' git reset --hard && echo content >>file && chmod +x file && @@ -184,13 +209,14 @@ test_expect_success FILEMODE 'stage mode and hunk= ' ' =20 # end of tests disabled when filemode is not usable =20 -test_expect_success 'setup again' ' +test_expect_success PERL 'setup again' ' git reset --hard && test_chmod +x file && echo content >>file ' =20 # Write the patch file with a new line at the top and bottom +test_expect_success PERL 'setup patch' ' cat >patch <expected <expected <non-empty && git add non-empty && @@ -242,13 +276,15 @@ test_expect_success 'deleting a non-empty file' ' test_cmp expected diff ' =20 +test_expect_success PERL 'setup expected' ' cat >expected < empty && git add empty && --=20 1.7.2.1.338.gf2379