@@ -3,12 +3,18 @@ extern crate assert_cmd;
33use assert_cmd::prelude::*;
44use std::process::Command;
55
6−fn bat() -> Command {
6+fn bat_with_config() -> Command {
77 let mut cmd = Command::main_binary().unwrap();
88 cmd.current_dir("tests/examples");
9− cmd.arg("--no-config");
109 cmd.env_remove("PAGER");
1110 cmd.env_remove("BAT_PAGER");
11+ cmd.env_remove("BAT_CONFIG_PATH");
12+ cmd
13+}
14+
15+fn bat() -> Command {
16+ let mut cmd = bat_with_config();
17+ cmd.arg("--no-config");
1218 cmd
1319}
1420
@@ -323,18 +329,9 @@ fn pager_disable() {
323329 .stdout("hello world\n");
324330}
325331
326−fn bat_config() -> Command {
327− let mut cmd = Command::main_binary().unwrap();
328− cmd.current_dir("tests/examples");
329− cmd.env_remove("BAT_PAGER");
330− cmd.env_remove("BAT_CONFIG_PATH");
331− cmd
332−}
333−
334332#[test]
335333fn config_location_test() {
336− bat_config()
337− .env_remove("BAT_CONFIG_PATH")
334+ bat_with_config()
338335 .env("BAT_CONFIG_PATH", "bat.conf")
339336 .arg("--config-file")
340337 .assert()
@@ -344,8 +341,7 @@ fn config_location_test() {
344341
345342#[test]
346343fn config_read_paging_test() {
347− bat_config()
348− .env_remove("BAT_CONFIG_PATH")
344+ bat_with_config()
349345 .env("BAT_CONFIG_PATH", "bat.conf")
350346 .env("BAT_PAGER", "echo testing-config-file")
351347 .arg("test.txt")