tests: test terminal output to both stdout and stderr
[git/kirr.git] / t / lib-terminal.sh
blob3258b8f0d5c36e0450ac5421b39b1ff4b3c379d0
1 #!/bin/sh
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
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 "$@"
25 test_set_prereq TTY
26 else
27 say "# no usable terminal, so skipping some tests"