wfxr.forgit/tests/pager.test.sh
Wenxuan Zhang 2420155e23
Some checks are pending
ci / build (macos-latest) (push) Waiting to run
ci / build (ubuntu-latest) (push) Waiting to run
ci / commitlint (push) Waiting to run
ci / format (push) Waiting to run
ci / rumdl-check (push) Waiting to run
ci / actionlint (push) Waiting to run
fix: preserve LESS options in enter pager
Pass the required color and stay-open flags directly to less so forgit no longer
replaces users' LESS environment options.

Add regression coverage and document the default behavior.
2026-08-25 13:57:48 +08:00

20 lines
414 B
Bash

#!/usr/bin/env bash
function set_up_before_script() {
source bin/git-forgit
}
function less() {
printf 'LESS=%s\n' "$LESS"
printf 'ARGS=%s\n' "$*"
}
function test_enter_pager_preserves_less_and_disables_automatic_exit() {
local actual
actual=$(LESS="-F -E -X -S -N" _forgit_pager enter)
assert_contains "LESS=-F -E -X -S -N" "$actual"
assert_contains "ARGS=-R -+F -+E" "$actual"
}