Re: [PATCH 2/4] t7006: test pager configuration for several git commands
> Test choice of pager at several stages of repository setup.
Here it is again, without whitespace changes. :)
t/t7006-pager.sh | 40 ++++++++++++++++++++++++++++++++++++----
1 files changed, 36 insertions(+), 4 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,7 +204,9 @@ parse_args() {
full_command="$full_command $1"
}
-parse_args expect_success 'git log'
+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 &&
@@ -223,8 +225,11 @@ $test_expectation SIMPLEPAGER "$cmd - default pager is used by default" "
) &&
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 &&
@@ -236,8 +241,11 @@ $test_expectation TTY "$cmd - PAGER overrides default pager" "
$full_command &&
test -e PAGER_used
"
+}
+
+test_core_pager_overrides() {
+ parse_args "$@"
-parse_args expect_success 'git log'
$test_expectation TTY "$cmd - core.pager overrides PAGER" "
unset GIT_PAGER;
rm -f core.pager_used ||
@@ -249,8 +257,11 @@ $test_expectation TTY "$cmd - core.pager overrides PAGER" "
$full_command &&
test -e core.pager_used
"
+}
+
+test_GIT_PAGER_overrides() {
+ parse_args "$@"
-parse_args expect_success 'git log'
$test_expectation TTY "$cmd - GIT_PAGER overrides core.pager" "
rm -f GIT_PAGER_used ||
cleanup_fail &&
@@ -261,5 +272,26 @@ $test_expectation TTY "$cmd - GIT_PAGER overrides core.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
--
1.7.1.579.ge2549