summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2018-11-04 10:46:56 +0100
committerDavid Peter <sharkdp@users.noreply.github.com>2018-11-04 11:19:49 +0100
commit48c6ea6b252ae8720db67b49773a90dd6a9f4536 (patch)
tree487a0476d14f466ce15c58c944413c9580cf54a2 /tests
parent558134f6c8a9c3601c48863a45f5c3bf7f125972 (diff)
Simplify integration test setup
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_tests.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 15dc872b..c5a67450 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -3,12 +3,18 @@ extern crate assert_cmd;
use assert_cmd::prelude::*;
use std::process::Command;
-fn bat() -> Command {
+fn bat_with_config() -> Command {
let mut cmd = Command::main_binary().unwrap();
cmd.current_dir("tests/examples");
- cmd.arg("--no-config");
cmd.env_remove("PAGER");
cmd.env_remove("BAT_PAGER");
+ cmd.env_remove("BAT_CONFIG_PATH");
+ cmd
+}
+
+fn bat() -> Command {
+ let mut cmd = bat_with_config();
+ cmd.arg("--no-config");
cmd
}
@@ -323,18 +329,9 @@ fn pager_disable() {
.stdout("hello world\n");
}
-fn bat_config() -> Command {
- let mut cmd = Command::main_binary().unwrap();
- cmd.current_dir("tests/examples");
- cmd.env_remove("BAT_PAGER");
- cmd.env_remove("BAT_CONFIG_PATH");
- cmd
-}
-
#[test]
fn config_location_test() {
- bat_config()
- .env_remove("BAT_CONFIG_PATH")
+ bat_with_config()
.env("BAT_CONFIG_PATH", "bat.conf")
.arg("--config-file")
.assert()
@@ -344,8 +341,7 @@ fn config_location_test() {
#[test]
fn config_read_paging_test() {
- bat_config()
- .env_remove("BAT_CONFIG_PATH")
+ bat_with_config()
.env("BAT_CONFIG_PATH", "bat.conf")
.env("BAT_PAGER", "echo testing-config-file")
.arg("test.txt")