Skip to content

Commit b6956d9

Browse files
committed
add test_requires readline
1 parent c9ed06c commit b6956d9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/tools/libtest.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,22 @@ require_git_version()
593593
fi
594594
}
595595

596+
has_readline()
597+
{
598+
# Test functionality, since there isn't a good way to inspect the binary.
599+
# bug: no timeout
600+
readline_exit_status=1
601+
file readline_guard.script <<-EOF
602+
:quit
603+
EOF
604+
605+
TIG_NO_DISPLAY=1 TIG_SCRIPT=readline_guard.script tig status </dev/null >/dev/null 2>&1 || true
606+
test -e .tig_history && readline_exit_status=0
607+
rm -f -- readline_guard.script .tig_history
608+
609+
return "$readline_exit_status"
610+
}
611+
596612
test_require()
597613
{
598614
while [ $# -gt 0 ]; do
@@ -622,6 +638,11 @@ test_require()
622638
test_skip "The test requires a '$feature' executable"
623639
fi
624640
;;
641+
readline)
642+
if ! has_readline; then
643+
test_skip "The test requires a tig compiled with readline"
644+
fi
645+
;;
625646
*)
626647
test_skip "Unknown feature requirement: $feature"
627648
esac

0 commit comments

Comments
 (0)