diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-03-08 20:23:03 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-03-09 21:53:45 -0500 |
commit | 1b90b4e1ba7516bb74a6746bebc8536659538d50 (patch) | |
tree | 4a65258f16c30656a923aa6c4e1dcf553576b074 | |
parent | 693d71d0bb6570705ae30bb732c20fe99fa49f14 (diff) |
Add navigate/less integration test
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | tests/test_navigate_less_history_file | 36 |
2 files changed, 37 insertions, 0 deletions
@@ -15,6 +15,7 @@ unit-test: end-to-end-test: build ./tests/test_raw_output_matches_git_on_full_repo_history ./tests/test_deprecated_options > /dev/null + ./test/test_navigate_less_history_file release: @make -f release.Makefile release diff --git a/tests/test_navigate_less_history_file b/tests/test_navigate_less_history_file new file mode 100755 index 00000000..c99c1d2c --- /dev/null +++ b/tests/test_navigate_less_history_file @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +die () { + echo "$1" 1>&2 + exit 1 +} + +DELTA_BIN=${1:-./target/release/delta} +DELTA="$DELTA_BIN --no-gitconfig --navigate" + +# Trick delta into thinking that its pager is less, when really it is cat. +TEMPDIR=$(mktemp -d) +DELTA_TEST_PAGER=$TEMPDIR/less +echo cat > $DELTA_TEST_PAGER +chmod +x $DELTA_TEST_PAGER +export PAGER=$DELTA_TEST_PAGER + +test_delta_less_hist_file_created () { + DELTA_HIST_FILE=~/.local/share/delta/lesshst + rm -f ~/.lesshst $DELTA_HIST_FILE + [ -e $DELTA_HIST_FILE ] && die "Expected $DELTA_HIST_FILE not to exist" + git -c core.pager="$DELTA" log -p HEAD~2...HEAD + [ -e $DELTA_HIST_FILE ] || die "Expected $DELTA_HIST_FILE to exist" +} + +test_delta_less_hist_file_created + +# Test it works with a custom LESSHISTFILE +DELTA_TEST_LESSHISTFILE=$(mktemp) +export LESSHISTFILE=TEMPDIR/delta.lesshst +test_delta_less_hist_file_created + +# Cleanup +rm -r "$TEMPDIR" |