summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-Kappes <87168492+J-Kappes@users.noreply.github.com>2023-09-14 03:45:46 +0000
committerGitHub <noreply@github.com>2023-09-14 05:45:46 +0200
commite2bf85e749d87459e3fced697af5cd9cc96eeb8c (patch)
treeef933d84d4087031b7bec05986ec6041bcfa8263 /tests
parentfe73010a5ed57d423e46469ee184ba74193bb727 (diff)
Make -pp override --paging and vice versa when passed as a later argument. (#2660)
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index b118c38f..aa5ca845 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -874,6 +874,42 @@ fn disable_pager_if_disable_paging_flag_comes_after_paging() {
}
#[test]
+fn disable_pager_if_pp_flag_comes_after_paging() {
+ bat()
+ .env("PAGER", "echo pager-output")
+ .arg("--paging=always")
+ .arg("-pp")
+ .arg("test.txt")
+ .assert()
+ .success()
+ .stdout(predicate::eq("hello world\n").normalize());
+}
+
+#[test]
+fn enable_pager_if_disable_paging_flag_comes_before_paging() {
+ bat()
+ .env("PAGER", "echo pager-output")
+ .arg("-P")
+ .arg("--paging=always")
+ .arg("test.txt")
+ .assert()
+ .success()
+ .stdout(predicate::eq("pager-output\n").normalize());
+}
+
+#[test]
+fn enable_pager_if_pp_flag_comes_before_paging() {
+ bat()
+ .env("PAGER", "echo pager-output")
+ .arg("-pp")
+ .arg("--paging=always")
+ .arg("test.txt")
+ .assert()
+ .success()
+ .stdout(predicate::eq("pager-output\n").normalize());
+}
+
+#[test]
fn pager_failed_to_parse() {
bat()
.env("BAT_PAGER", "mismatched-quotes 'a")