]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t7006-pager.sh
Merge branch 'en/and-cascade-tests'
[git.git] / t / t7006-pager.sh
index 7d00d49d0da6487bec345176411e1f51e712f137..e9d8b9110d3bb14a0c1d5b325b875abce57b3318 100755 (executable)
@@ -4,42 +4,13 @@ test_description='Test automatic use of a pager.'
 
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-pager.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
 
 cleanup_fail() {
        echo >&2 cleanup failed
        (exit 1)
 }
 
-test_expect_success 'set up terminal for tests' '
-       rm -f stdout_is_tty ||
-       cleanup_fail &&
-
-       if test -t 1
-       then
-               >stdout_is_tty
-       elif
-               test_have_prereq PERL &&
-               "$PERL_PATH" "$TEST_DIRECTORY"/t7006/test-terminal.perl \
-                       sh -c "test -t 1"
-       then
-               >test_terminal_works
-       fi
-'
-
-if test -e stdout_is_tty
-then
-       test_terminal() { "$@"; }
-       test_set_prereq TTY
-elif test -e test_terminal_works
-then
-       test_terminal() {
-               "$PERL_PATH" "$TEST_DIRECTORY"/t7006/test-terminal.perl "$@"
-       }
-       test_set_prereq TTY
-else
-       say "# no usable terminal, so skipping some tests"
-fi
-
 test_expect_success 'setup' '
        sane_unset GIT_PAGER GIT_PAGER_IN_USE &&
        test_might_fail git config --unset core.pager &&
@@ -213,11 +184,6 @@ test_expect_success 'color when writing to a file intended for a pager' '
        colorful colorful.log
 '
 
-if test_have_prereq SIMPLEPAGER && test_have_prereq TTY
-then
-       test_set_prereq SIMPLEPAGERTTY
-fi
-
 # Use this helper to make it easy for the caller of your
 # terminal-using function to specify whether it should fail.
 # If you write
@@ -253,7 +219,7 @@ parse_args() {
 test_default_pager() {
        parse_args "$@"
 
-       $test_expectation SIMPLEPAGERTTY "$cmd - default pager is used by default" "
+       $test_expectation SIMPLEPAGER,TTY "$cmd - default pager is used by default" "
                sane_unset PAGER GIT_PAGER &&
                test_might_fail git config --unset core.pager &&
                rm -f default_pager_used ||