diff options
author | Ricky <Ricky@Hosfelt.io> | 2018-11-01 15:48:56 +0000 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2018-11-04 11:19:49 +0100 |
commit | 558134f6c8a9c3601c48863a45f5c3bf7f125972 (patch) | |
tree | 58b5c8e29726e8b66d3359d103eaf5c47ffc72fd /tests | |
parent | 1dd57e6d7e0e7325c49bca8baac610c5312922a9 (diff) |
Changed to unwrap methods, added integration tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/bat.conf | 1 | ||||
-rw-r--r-- | tests/integration_tests.rs | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/examples/bat.conf b/tests/examples/bat.conf new file mode 100644 index 00000000..96a04342 --- /dev/null +++ b/tests/examples/bat.conf @@ -0,0 +1 @@ +--paging=always
\ No newline at end of file diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 28f30ddd..15dc872b 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -322,3 +322,34 @@ fn pager_disable() { .success() .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") + .env("BAT_CONFIG_PATH", "bat.conf") + .arg("--config-file") + .assert() + .success() + .stdout("bat.conf\n"); +} + +#[test] +fn config_read_paging_test() { + bat_config() + .env_remove("BAT_CONFIG_PATH") + .env("BAT_CONFIG_PATH", "bat.conf") + .env("BAT_PAGER", "echo testing-config-file") + .arg("test.txt") + .assert() + .success() + .stdout("testing-config-file\n"); +} |