mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-22 15:53:29 +01:00
Add integration tests for pager handling
This commit is contained in:
parent
bb1f5aa841
commit
2c7087b8de
@ -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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user