diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-04-24 13:37:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-24 13:37:50 -0400 |
commit | ab77bff0fca94551853459b011533693f6c68e1d (patch) | |
tree | db9ccc9393797445c44a7da1859f7288074e48f7 | |
parent | eef33b6b33053db3dc07fb92d9a6eb55c089f5fe (diff) |
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
-rwxr-xr-x | tests/test_navigate_less_history_file | 8 |
1 files changed, 7 insertions, 1 deletions
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" } |