From ab77bff0fca94551853459b011533693f6c68e1d Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sat, 24 Apr 2021 13:37:50 -0400 Subject: Run test of less on MacOS with output redirected to /dev/null (#574) This change makes git and delta believe that they are writing to a tty so that they invoke their child pager processes, as is required for the test. However, output is actually redirected to /dev/null. TODO: implement for the Linux version of script also. https://stackoverflow.com/a/1402389/583763 --- tests/test_navigate_less_history_file | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_navigate_less_history_file b/tests/test_navigate_less_history_file index 7ec5a95f..148ed2d5 100755 --- a/tests/test_navigate_less_history_file +++ b/tests/test_navigate_less_history_file @@ -28,7 +28,13 @@ test_delta_less_hist_file_created () { DELTA_HIST_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/delta/lesshst" rm -f ~/.lesshst "$DELTA_HIST_FILE" [ -e "$DELTA_HIST_FILE" ] && die "Expected \"$DELTA_HIST_FILE\" not to exist" - git -c pager.log="$DELTA" log -p HEAD~2...HEAD + if [[ "$OSTYPE" = darwin* ]]; then + # Trick git and delta into invoking their pager child processes, despite + # output not being a tty. + script -q /dev/null git -c pager.log="$DELTA" log -p HEAD~2...HEAD > /dev/null + else + git -c pager.log="$DELTA" log -p HEAD~2...HEAD + fi [ -e "$DELTA_HIST_FILE" ] || die "Expected \"$DELTA_HIST_FILE\" to exist" } -- cgit v1.2.3