diff options
author | sharkdp <davidpeter@web.de> | 2018-10-17 20:44:15 +0200 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2018-10-17 21:08:32 +0200 |
commit | 2c7087b8de797d18b7a8d5f8b33fc32adb8ecca1 (patch) | |
tree | 868bbc5dc2b892bc00fa5ef3a17259f2defe3d89 /tests | |
parent | bb1f5aa841d3495ae99b8796035ad7300b8f9155 (diff) |
Add integration tests for pager handling
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration_tests.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index be68d677..23acf3fc 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -7,6 +7,8 @@ fn bat() -> Command { let mut cmd = Command::main_binary().unwrap(); cmd.current_dir("tests/examples"); cmd.arg("--no-config"); + cmd.env_remove("PAGER"); + cmd.env_remove("BAT_PAGER"); cmd } @@ -113,3 +115,38 @@ fn do_not_exit_directory() { .stdout("hello world\n") .failure(); } + +#[test] +fn pager_basic() { + bat() + .env("PAGER", "echo pager-output") + .arg("--paging=always") + .arg("test.txt") + .assert() + .success() + .stdout("pager-output\n"); +} + +#[test] +fn pager_overwrite() { + bat() + .env("PAGER", "echo other-pager") + .env("BAT_PAGER", "echo pager-output") + .arg("--paging=always") + .arg("test.txt") + .assert() + .success() + .stdout("pager-output\n"); +} + +#[test] +fn pager_disable() { + bat() + .env("PAGER", "echo other-pager") + .env("BAT_PAGER", "") + .arg("--paging=always") + .arg("test.txt") + .assert() + .success() + .stdout("hello world\n"); +} |