summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Nordholts <enselic@gmail.com>2021-01-10 16:48:13 +0100
committerDavid Peter <sharkdp@users.noreply.github.com>2021-01-11 21:56:10 +0100
commitdd0d44bbb3608618427153515a71cdc11c041988 (patch)
tree01dc4f56de4f92e18c6eda30f4c71d6b86b353f2 /tests
parent060b9981b545cb7c813c3261442c9fa718e4d61a (diff)
Fix #1413 Can't use `bat` at all! (Error: Use of bat as a pager is disallowed...)
Fixed by implementing the proposal by sharkdp: * Allow PAGER=bat, but ignore the setting in bat and simply default to less. Unless of course, BAT_PAGER or --pager is used to overwrite the value of PAGER. * Disallow the usage of bat within BAT_PAGER and --pager.
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 6128b801..ce44933b 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -500,13 +500,36 @@ fn pager_disable() {
}
#[test]
+fn env_var_pager_value_bat() {
+ bat()
+ .env("PAGER", "bat")
+ .arg("--paging=always")
+ .arg("test.txt")
+ .assert()
+ .success()
+ .stdout(predicate::eq("hello world\n").normalize());
+}
+
+#[test]
+fn env_var_bat_pager_value_bat() {
+ bat()
+ .env("BAT_PAGER", "bat")
+ .arg("--paging=always")
+ .arg("test.txt")
+ .assert()
+ .failure()
+ .stderr(predicate::str::contains("bat as a pager is disallowed"));
+}
+
+#[test]
fn pager_value_bat() {
bat()
.arg("--pager=bat")
.arg("--paging=always")
.arg("test.txt")
.assert()
- .failure();
+ .failure()
+ .stderr(predicate::str::contains("bat as a pager is disallowed"));
}
/// We shall use less instead of most if PAGER is used since PAGER