diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-09-01 03:08:38 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2020-09-01 03:08:46 -0400 |
commit | 663ae6c5c25a2ef88eff856c202265c8a1455f06 (patch) | |
tree | fa11a47464d9088a76f3a89eaef7368f129feff0 /tests | |
parent | d24a797ce9a137cbce68d621693dc7db60db2ba8 (diff) |
bug: fix broken check from last commit, add tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arg_tests.rs | 14 | ||||
-rw-r--r-- | tests/invalid_config_tests.rs | 11 | ||||
-rw-r--r-- | tests/invalid_configs/invalid_default_widget_count.toml | 2 |
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/arg_tests.rs b/tests/arg_tests.rs index f6dac340..6f19eb8c 100644 --- a/tests/arg_tests.rs +++ b/tests/arg_tests.rs @@ -156,3 +156,17 @@ fn test_invalid_default_widget_2() -> Result<(), Box<dyn std::error::Error>> { Ok(()) } + +#[test] +fn test_missing_default_widget_type() -> Result<(), Box<dyn std::error::Error>> { + Command::new(get_binary_location()) + .arg("--default_widget_count") + .arg("3") + .assert() + .failure() + .stderr(predicate::str::contains( + "The following required arguments were not provided", + )); + + Ok(()) +} diff --git a/tests/invalid_config_tests.rs b/tests/invalid_config_tests.rs index cda6beb5..49db85da 100644 --- a/tests/invalid_config_tests.rs +++ b/tests/invalid_config_tests.rs @@ -147,3 +147,14 @@ fn test_empty_battery() -> Result<(), Box<dyn std::error::Error>> { )); Ok(()) } + +#[test] +fn test_invalid_default_widget_count() -> Result<(), Box<dyn std::error::Error>> { + Command::new(get_binary_location()) + .arg("-C") + .arg("./tests/invalid_configs/invalid_default_widget_count.toml") + .assert() + .failure() + .stderr(predicate::str::contains("it must be used with")); + Ok(()) +} diff --git a/tests/invalid_configs/invalid_default_widget_count.toml b/tests/invalid_configs/invalid_default_widget_count.toml new file mode 100644 index 00000000..0e299d12 --- /dev/null +++ b/tests/invalid_configs/invalid_default_widget_count.toml @@ -0,0 +1,2 @@ +[flags] +default_widget_count = 3
\ No newline at end of file |