mirror of
https://github.com/sharkdp/bat.git
synced 2025-10-30 14:43:57 +00:00
Add test for systemwide config file support
There is now a new stage in the CICD workflow present, which will build `bat` with the `BAT_SYSTEM_CONFIG_PREFIX` set to load the config file from `/tests/examples/system_config/bat/config`, plus a basic set of tests, to ensure the feature is working as expected. By default the tests are set to ignored, as they need special setup before they can be run.
This commit is contained in:
29
tests/system_wide_config.rs
Normal file
29
tests/system_wide_config.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use predicates::{prelude::predicate, str::PredicateStrExt};
|
||||
|
||||
mod utils;
|
||||
use utils::command::bat_with_config;
|
||||
|
||||
// This test is ignored, as it needs a special system wide config put into place.
|
||||
// In order to run this tests, use `cargo test --test system_wide_config -- --ignored`
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn use_systemwide_config() {
|
||||
bat_with_config()
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("dummy-pager-from-system-config\n").normalize());
|
||||
}
|
||||
|
||||
// This test is ignored, as it needs a special system wide config put into place
|
||||
// In order to run this tests, use `cargo test --test system_wide_config -- --ignored`
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn config_overrides_system_config() {
|
||||
bat_with_config()
|
||||
.env("BAT_CONFIG_PATH", "bat.conf")
|
||||
.arg("test.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::eq("dummy-pager-from-config\n").normalize());
|
||||
}
|
||||
Reference in New Issue
Block a user