@@ -7,6 +7,8 @@ fn bat() -> Command {
77 let mut cmd = Command::main_binary().unwrap();
88 cmd.current_dir("tests/examples");
99 cmd.arg("--no-config");
10+ cmd.env_remove("PAGER");
11+ cmd.env_remove("BAT_PAGER");
1012 cmd
1113}
1214
@@ -113,3 +115,38 @@ fn do_not_exit_directory() {
113115 .stdout("hello world\n")
114116 .failure();
115117}
118+
119+#[test]
120+fn pager_basic() {
121+ bat()
122+ .env("PAGER", "echo pager-output")
123+ .arg("--paging=always")
124+ .arg("test.txt")
125+ .assert()
126+ .success()
127+ .stdout("pager-output\n");
128+}
129+
130+#[test]
131+fn pager_overwrite() {
132+ bat()
133+ .env("PAGER", "echo other-pager")
134+ .env("BAT_PAGER", "echo pager-output")
135+ .arg("--paging=always")
136+ .arg("test.txt")
137+ .assert()
138+ .success()
139+ .stdout("pager-output\n");
140+}
141+
142+#[test]
143+fn pager_disable() {
144+ bat()
145+ .env("PAGER", "echo other-pager")
146+ .env("BAT_PAGER", "")
147+ .arg("--paging=always")
148+ .arg("test.txt")
149+ .assert()
150+ .success()
151+ .stdout("hello world\n");
152+}