mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-02 03:12:25 +01:00
Add integration tests for pager handling
This commit is contained in:
@@ -7,6 +7,8 @@ fn bat() -> Command {
|
|||||||
let mut cmd = Command::main_binary().unwrap();
|
let mut cmd = Command::main_binary().unwrap();
|
||||||
cmd.current_dir("tests/examples");
|
cmd.current_dir("tests/examples");
|
||||||
cmd.arg("--no-config");
|
cmd.arg("--no-config");
|
||||||
|
cmd.env_remove("PAGER");
|
||||||
|
cmd.env_remove("BAT_PAGER");
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,3 +115,38 @@ fn do_not_exit_directory() {
|
|||||||
.stdout("hello world\n")
|
.stdout("hello world\n")
|
||||||
.failure();
|
.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");
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user