diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arg_tests.rs | 23 | ||||
-rw-r--r-- | tests/util.rs | 4 |
2 files changed, 21 insertions, 6 deletions
diff --git a/tests/arg_tests.rs b/tests/arg_tests.rs index 372955da..95e79994 100644 --- a/tests/arg_tests.rs +++ b/tests/arg_tests.rs @@ -93,9 +93,7 @@ fn test_negative_rate() { .arg("-1000") .assert() .failure() - .stderr(predicate::str::contains( - "wasn't expected, or isn't valid in this context", - )); + .stderr(predicate::str::contains("unexpected argument")); } #[test] @@ -160,11 +158,12 @@ fn test_missing_default_widget_type() { .assert() .failure() .stderr(predicate::str::contains( - "The following required arguments were not provided", + "the following required arguments were not provided", )); } #[test] +#[cfg_attr(feature = "battery", ignore)] fn test_battery_flag() { if !cfg!(feature = "battery") { btm_command() @@ -172,7 +171,21 @@ fn test_battery_flag() { .assert() .failure() .stderr(predicate::str::contains( - "'--battery' which wasn't expected", + "unexpected argument '--battery' found", + )); + } +} + +#[test] +#[cfg_attr(feature = "gpu", ignore)] +fn test_gpu_flag() { + if !cfg!(feature = "gpu") { + btm_command() + .arg("--enable_gpu_memory") + .assert() + .failure() + .stderr(predicate::str::contains( + "unexpected argument '--enable_gpu_memory' found", )); } } diff --git a/tests/util.rs b/tests/util.rs index 40e50305..5a9dbc1a 100644 --- a/tests/util.rs +++ b/tests/util.rs @@ -60,13 +60,15 @@ fn cross_runner() -> Option<String> { } } -/// Returns the [`Command`] of a binary invocation of bottom. +/// Returns the [`Command`] of a binary invocation of bottom, alongside +/// any required env variables. pub fn btm_command() -> Command { let btm_exe = env!("CARGO_BIN_EXE_btm"); match cross_runner() { None => Command::new(btm_exe), Some(runner) => { let mut cmd = Command::new(runner); + cmd.env("NO_COLOR", "1"); cmd.arg(btm_exe); cmd } |