summaryrefslogtreecommitdiff
path: root/t/t7006-pager.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-06-26 19:24:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-28 17:31:17 (GMT)
commit8f81449e885ab2b9bac09b5b835314d26f107b3f (patch)
treeb8e744ad5dd6a528d00161286662995844af9d91 /t/t7006-pager.sh
parent3c7406d4b595c9e8c8dfcff2739bab9412add5a3 (diff)
downloadgit-8f81449e885ab2b9bac09b5b835314d26f107b3f.zip
git-8f81449e885ab2b9bac09b5b835314d26f107b3f.tar.gz
git-8f81449e885ab2b9bac09b5b835314d26f107b3f.tar.bz2
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>
Diffstat (limited to 't/t7006-pager.sh')
-rwxr-xr-xt/t7006-pager.sh136
1 files changed, 84 insertions, 52 deletions
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index b117ebb..4420f91 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -204,62 +204,94 @@ parse_args() {
full_command="$full_command $1"
}
-parse_args expect_success 'git log'
-$test_expectation SIMPLEPAGER "$cmd - default pager is used by default" "
- unset PAGER GIT_PAGER;
- test_might_fail git config --unset core.pager &&
- rm -f default_pager_used ||
- cleanup_fail &&
+test_default_pager() {
+ parse_args "$@"
+
+ $test_expectation SIMPLEPAGER "$cmd - default pager is used by default" "
+ unset PAGER GIT_PAGER;
+ test_might_fail git config --unset core.pager &&
+ rm -f default_pager_used ||
+ cleanup_fail &&
+
+ cat >\$less <<-\EOF &&
+ #!/bin/sh
+ wc >default_pager_used
+ EOF
+ chmod +x \$less &&
+ (
+ PATH=.:\$PATH &&
+ export PATH &&
+ $full_command
+ ) &&
+ test -e default_pager_used
+ "
+}
- cat >\$less <<-\EOF &&
- #!/bin/sh
- wc >default_pager_used
- EOF
- chmod +x \$less &&
- (
- PATH=.:\$PATH &&
- export PATH &&
- $full_command
- ) &&
- test -e default_pager_used
-"
+test_PAGER_overrides() {
+ parse_args "$@"
-parse_args expect_success 'git log'
-$test_expectation TTY "$cmd - PAGER overrides default pager" "
- unset GIT_PAGER;
- test_might_fail git config --unset core.pager &&
- rm -f PAGER_used ||
- cleanup_fail &&
+ $test_expectation TTY "$cmd - PAGER overrides default pager" "
+ unset GIT_PAGER;
+ test_might_fail git config --unset core.pager &&
+ rm -f PAGER_used ||
+ cleanup_fail &&
- PAGER='wc >PAGER_used' &&
- export PAGER &&
- $full_command &&
- test -e PAGER_used
-"
-
-parse_args expect_success 'git log'
-$test_expectation TTY "$cmd - core.pager overrides PAGER" "
- unset GIT_PAGER;
- rm -f core.pager_used ||
- cleanup_fail &&
+ PAGER='wc >PAGER_used' &&
+ export PAGER &&
+ $full_command &&
+ test -e PAGER_used
+ "
+}
- PAGER=wc &&
- export PAGER &&
- git config core.pager 'wc >core.pager_used' &&
- $full_command &&
- test -e core.pager_used
-"
-
-parse_args expect_success 'git log'
-$test_expectation TTY "$cmd - GIT_PAGER overrides core.pager" "
- rm -f GIT_PAGER_used ||
- cleanup_fail &&
+test_core_pager_overrides() {
+ parse_args "$@"
+
+ $test_expectation TTY "$cmd - core.pager overrides PAGER" "
+ unset GIT_PAGER;
+ rm -f core.pager_used ||
+ cleanup_fail &&
+
+ PAGER=wc &&
+ export PAGER &&
+ git config core.pager 'wc >core.pager_used' &&
+ $full_command &&
+ test -e core.pager_used
+ "
+}
+
+test_GIT_PAGER_overrides() {
+ parse_args "$@"
+
+ $test_expectation TTY "$cmd - GIT_PAGER overrides core.pager" "
+ rm -f GIT_PAGER_used ||
+ cleanup_fail &&
+
+ git config core.pager wc &&
+ GIT_PAGER='wc >GIT_PAGER_used' &&
+ export GIT_PAGER &&
+ $full_command &&
+ test -e GIT_PAGER_used
+ "
+}
- git config core.pager wc &&
- GIT_PAGER='wc >GIT_PAGER_used' &&
- export GIT_PAGER &&
- $full_command &&
- 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