summaryrefslogtreecommitdiff
path: root/t/lib-terminal.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/lib-terminal.sh')
-rw-r--r--t/lib-terminal.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
new file mode 100644
index 0000000000..c383b57ed9
--- /dev/null
+++ b/t/lib-terminal.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+test_expect_success 'set up terminal for tests' '
+ if
+ test_have_prereq PERL &&
+ "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl \
+ sh -c "test -t 1 && test -t 2"
+ then
+ test_set_prereq TTY &&
+ test_terminal () {
+ if ! test_declared_prereq TTY
+ then
+ echo >&4 "test_terminal: need to declare TTY prerequisite"
+ return 127
+ fi
+ "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl "$@"
+ }
+ fi
+'