t7006: test pager configuration for several git commands

Test choice of pager at several stages of repository setup.  This
provides some (admittedly uninteresting) examples to keep in mind when
considering changes to the setup procedure.

Improved-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Nieder 2010-06-26 14:24:50 -05:00 committed by Junio C Hamano
parent 3c7406d4b5
commit 8f81449e88
1 changed files with 82 additions and 50 deletions

View File

@ -204,8 +204,10 @@ parse_args() {
full_command="$full_command $1" full_command="$full_command $1"
} }


parse_args expect_success 'git log' test_default_pager() {
$test_expectation SIMPLEPAGER "$cmd - default pager is used by default" " parse_args "$@"

$test_expectation SIMPLEPAGER "$cmd - default pager is used by default" "
unset PAGER GIT_PAGER; unset PAGER GIT_PAGER;
test_might_fail git config --unset core.pager && test_might_fail git config --unset core.pager &&
rm -f default_pager_used || rm -f default_pager_used ||
@ -222,10 +224,13 @@ $test_expectation SIMPLEPAGER "$cmd - default pager is used by default" "
$full_command $full_command
) && ) &&
test -e default_pager_used test -e default_pager_used
" "
}


parse_args expect_success 'git log' test_PAGER_overrides() {
$test_expectation TTY "$cmd - PAGER overrides default pager" " parse_args "$@"

$test_expectation TTY "$cmd - PAGER overrides default pager" "
unset GIT_PAGER; unset GIT_PAGER;
test_might_fail git config --unset core.pager && test_might_fail git config --unset core.pager &&
rm -f PAGER_used || rm -f PAGER_used ||
@ -235,10 +240,13 @@ $test_expectation TTY "$cmd - PAGER overrides default pager" "
export PAGER && export PAGER &&
$full_command && $full_command &&
test -e PAGER_used test -e PAGER_used
" "
}


parse_args expect_success 'git log' test_core_pager_overrides() {
$test_expectation TTY "$cmd - core.pager overrides PAGER" " parse_args "$@"

$test_expectation TTY "$cmd - core.pager overrides PAGER" "
unset GIT_PAGER; unset GIT_PAGER;
rm -f core.pager_used || rm -f core.pager_used ||
cleanup_fail && cleanup_fail &&
@ -248,10 +256,13 @@ $test_expectation TTY "$cmd - core.pager overrides PAGER" "
git config core.pager 'wc >core.pager_used' && git config core.pager 'wc >core.pager_used' &&
$full_command && $full_command &&
test -e core.pager_used test -e core.pager_used
" "
}


parse_args expect_success 'git log' test_GIT_PAGER_overrides() {
$test_expectation TTY "$cmd - GIT_PAGER overrides core.pager" " parse_args "$@"

$test_expectation TTY "$cmd - GIT_PAGER overrides core.pager" "
rm -f GIT_PAGER_used || rm -f GIT_PAGER_used ||
cleanup_fail && cleanup_fail &&


@ -260,6 +271,27 @@ $test_expectation TTY "$cmd - GIT_PAGER overrides core.pager" "
export GIT_PAGER && export GIT_PAGER &&
$full_command && $full_command &&
test -e GIT_PAGER_used test -e GIT_PAGER_used
" "
}

test_default_pager expect_success 'git log'
test_PAGER_overrides expect_success 'git log'
test_core_pager_overrides expect_success 'git log'
test_GIT_PAGER_overrides expect_success 'git log'

test_default_pager expect_success 'git -p log'
test_PAGER_overrides expect_success 'git -p log'
test_core_pager_overrides expect_success 'git -p log'
test_GIT_PAGER_overrides expect_success 'git -p log'

test_default_pager expect_success test_must_fail 'git -p'
test_PAGER_overrides expect_success test_must_fail 'git -p'
test_core_pager_overrides expect_success test_must_fail 'git -p'
test_GIT_PAGER_overrides expect_success test_must_fail 'git -p'

test_default_pager expect_success test_must_fail 'git -p nonsense'
test_PAGER_overrides expect_success test_must_fail 'git -p nonsense'
test_core_pager_overrides expect_success test_must_fail 'git -p nonsense'
test_GIT_PAGER_overrides expect_success test_must_fail 'git -p nonsense'


test_done test_done