]> asedeno.scripts.mit.edu Git - git.git/blob - t/lib-terminal.sh
tests: test terminal output to both stdout and stderr
[git.git] / t / lib-terminal.sh
1 #!/bin/sh
2
3 test_expect_success 'set up terminal for tests' '
4         if test -t 1 && test -t 2
5         then
6                 >have_tty
7         elif
8                 test_have_prereq PERL &&
9                 "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl \
10                         sh -c "test -t 1 && test -t 2"
11         then
12                 >test_terminal_works
13         fi
14 '
15
16 if test -e have_tty
17 then
18         test_terminal() { "$@"; }
19         test_set_prereq TTY
20 elif test -e test_terminal_works
21 then
22         test_terminal() {
23                 "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl "$@"
24         }
25         test_set_prereq TTY
26 else
27         say "# no usable terminal, so skipping some tests"
28 fi