From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Steffen Daode Nurpmeso" <sdaoden@googlemail.com>,
"Ingo Brückl" <ib@wupperonline.de>
Subject: [PATCH 03/10] t7006: use test_config helpers
Date: Wed, 17 Aug 2011 22:02:06 -0700 [thread overview]
Message-ID: <20110818050204.GC2889@sigill.intra.peff.net> (raw)
In-Reply-To: <20110818045821.GA17377@sigill.intra.peff.net>
In some cases, this is just making the test script a little
shorter and easier to read. However, there are several
places where we didn't take proper precautions against
polluting downstream tests with our config; this fixes them,
too.
Signed-off-by: Jeff King <peff@peff.net>
---
| 39 ++++++++++++++++++---------------------
1 files changed, 18 insertions(+), 21 deletions(-)
--git a/t/t7006-pager.sh b/t/t7006-pager.sh
index c0a3135..2ac729f 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -13,7 +13,7 @@ cleanup_fail() {
test_expect_success 'setup' '
sane_unset GIT_PAGER GIT_PAGER_IN_USE &&
- test_might_fail git config --unset core.pager &&
+ test_unconfig core.pager &&
PAGER="cat >paginated.out" &&
export PAGER &&
@@ -94,21 +94,19 @@ test_expect_success TTY 'no pager with --no-pager' '
test_expect_success TTY 'configuration can disable pager' '
rm -f paginated.out &&
- test_might_fail git config --unset pager.grep &&
+ test_unconfig pager.grep &&
test_terminal git grep initial &&
test -e paginated.out &&
rm -f paginated.out &&
- git config pager.grep false &&
- test_when_finished "git config --unset pager.grep" &&
+ test_config pager.grep false &&
test_terminal git grep initial &&
! test -e paginated.out
'
test_expect_success TTY 'git config uses a pager if configured to' '
rm -f paginated.out &&
- git config pager.config true &&
- test_when_finished "git config --unset pager.config" &&
+ test_config pager.config true &&
test_terminal git config --list &&
test -e paginated.out
'
@@ -116,8 +114,7 @@ test_expect_success TTY 'git config uses a pager if configured to' '
test_expect_success TTY 'configuration can enable pager (from subdir)' '
rm -f paginated.out &&
mkdir -p subdir &&
- git config pager.bundle true &&
- test_when_finished "git config --unset pager.bundle" &&
+ test_config pager.bundle true &&
git bundle create test.bundle --all &&
rm -f paginated.out subdir/paginated.out &&
@@ -150,7 +147,7 @@ test_expect_success 'tests can detect color' '
test_expect_success 'no color when stdout is a regular file' '
rm -f colorless.log &&
- git config color.ui auto ||
+ test_config color.ui auto ||
cleanup_fail &&
git log >colorless.log &&
@@ -159,7 +156,7 @@ test_expect_success 'no color when stdout is a regular file' '
test_expect_success TTY 'color when writing to a pager' '
rm -f paginated.out &&
- git config color.ui auto ||
+ test_config color.ui auto ||
cleanup_fail &&
(
@@ -172,7 +169,7 @@ test_expect_success TTY 'color when writing to a pager' '
test_expect_success 'color when writing to a file intended for a pager' '
rm -f colorful.log &&
- git config color.ui auto ||
+ test_config color.ui auto ||
cleanup_fail &&
(
@@ -221,7 +218,7 @@ test_default_pager() {
$test_expectation SIMPLEPAGER,TTY "$cmd - default pager is used by default" "
sane_unset PAGER GIT_PAGER &&
- test_might_fail git config --unset core.pager &&
+ test_unconfig core.pager &&
rm -f default_pager_used ||
cleanup_fail &&
@@ -244,7 +241,7 @@ test_PAGER_overrides() {
$test_expectation TTY "$cmd - PAGER overrides default pager" "
sane_unset GIT_PAGER &&
- test_might_fail git config --unset core.pager &&
+ test_unconfig core.pager &&
rm -f PAGER_used ||
cleanup_fail &&
@@ -277,7 +274,7 @@ test_core_pager() {
PAGER=wc &&
export PAGER &&
- git config core.pager 'wc >core.pager_used' &&
+ test_config core.pager 'wc >core.pager_used' &&
$full_command &&
${if_local_config}test -e core.pager_used
"
@@ -307,7 +304,7 @@ test_pager_subdir_helper() {
PAGER=wc &&
stampname=\$(pwd)/core.pager_used &&
export PAGER stampname &&
- git config core.pager 'wc >\"\$stampname\"' &&
+ test_config core.pager 'wc >\"\$stampname\"' &&
mkdir sub &&
(
cd sub &&
@@ -324,7 +321,7 @@ test_GIT_PAGER_overrides() {
rm -f GIT_PAGER_used ||
cleanup_fail &&
- git config core.pager wc &&
+ test_config core.pager wc &&
GIT_PAGER='wc >GIT_PAGER_used' &&
export GIT_PAGER &&
$full_command &&
@@ -405,8 +402,8 @@ test_expect_success TTY 'command-specific pager' '
sane_unset PAGER GIT_PAGER &&
echo "foo:initial" >expect &&
>actual &&
- git config --unset core.pager &&
- git config pager.log "sed s/^/foo:/ >actual" &&
+ test_unconfig core.pager &&
+ test_config pager.log "sed s/^/foo:/ >actual" &&
test_terminal git log --format=%s -1 &&
test_cmp expect actual
'
@@ -415,8 +412,8 @@ test_expect_success TTY 'command-specific pager overrides core.pager' '
sane_unset PAGER GIT_PAGER &&
echo "foo:initial" >expect &&
>actual &&
- git config core.pager "exit 1"
- git config pager.log "sed s/^/foo:/ >actual" &&
+ test_config core.pager "exit 1"
+ test_config pager.log "sed s/^/foo:/ >actual" &&
test_terminal git log --format=%s -1 &&
test_cmp expect actual
'
@@ -425,7 +422,7 @@ test_expect_success TTY 'command-specific pager overridden by environment' '
GIT_PAGER="sed s/^/foo:/ >actual" && export GIT_PAGER &&
>actual &&
echo "foo:initial" >expect &&
- git config pager.log "exit 1" &&
+ test_config pager.log "exit 1" &&
test_terminal git log --format=%s -1 &&
test_cmp expect actual
'
--
1.7.6.10.g62f04
next prev parent reply other threads:[~2011-08-18 5:02 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-18 4:58 [PATCH 0/10] color and pager improvements Jeff King
2011-08-18 5:00 ` [PATCH 01/10] t7006: modernize calls to unset Jeff King
2011-08-18 21:05 ` Junio C Hamano
2011-08-18 5:01 ` [PATCH 02/10] test-lib: add helper functions for config Jeff King
2011-08-18 21:10 ` Junio C Hamano
2011-08-18 5:02 ` Jeff King [this message]
2011-08-18 5:02 ` [PATCH 04/10] setup_pager: set GIT_PAGER_IN_USE Jeff King
2011-08-18 5:03 ` [PATCH 05/10] diff: refactor COLOR_DIFF from a flag into an int Jeff King
2011-08-18 5:03 ` [PATCH 06/10] git_config_colorbool: refactor stdout_is_tty handling Jeff King
2011-08-18 5:04 ` [PATCH 07/10] color: delay auto-color decision until point of use Jeff King
2011-08-18 21:59 ` Junio C Hamano
2011-08-18 22:28 ` Jeff King
2011-08-18 5:04 ` [PATCH 08/10] config: refactor get_colorbool function Jeff King
2011-08-18 5:05 ` [PATCH 09/10] diff: don't load color config in plumbing Jeff King
2011-08-18 5:05 ` [PATCH 10/10] want_color: automatically fallback to color.ui Jeff King
2011-09-04 2:36 ` Martin von Zweigbergk
2011-09-04 12:53 ` Jeff King
2011-09-05 11:31 ` Steffen Daode Nurpmeso
2011-08-18 21:58 ` [PATCH 0/10] color and pager improvements Jeff King
2011-08-18 21:59 ` [PATCH 11/10] support pager.* for aliases Jeff King
2011-08-18 22:54 ` Junio C Hamano
2011-08-19 3:37 ` Jeff King
2011-08-19 4:18 ` Junio C Hamano
2011-08-19 4:40 ` Jeff King
2011-08-19 5:23 ` Junio C Hamano
2011-08-19 5:43 ` Junio C Hamano
2011-08-19 8:30 ` Jeff King
2011-08-18 22:01 ` [PATCH 12/10] support pager.* for external commands Jeff King
2011-08-18 22:56 ` Junio C Hamano
2012-02-12 0:46 ` Ævar Arnfjörð Bjarmason
2012-02-14 19:13 ` Jeff King
2011-08-18 22:33 ` [PATCH 0/10] color and pager improvements Ingo Brückl
2011-08-18 22:46 ` Jeff King
2011-08-19 6:34 ` Ingo Brückl
2011-08-25 20:25 ` Jeff King
2011-08-18 21:59 ` Steffen Daode Nurpmeso
2011-08-18 22:02 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110818050204.GC2889@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ib@wupperonline.de \
--cc=sdaoden@googlemail.com \
/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.
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).