diff options
Diffstat (limited to 'tests/config_tests.rs')
-rw-r--r-- | tests/config_tests.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/config_tests.rs b/tests/config_tests.rs new file mode 100644 index 0000000..21dcb4e --- /dev/null +++ b/tests/config_tests.rs @@ -0,0 +1,36 @@ +use std::env; +use std::path::Path; +use std::process::{Command, Output}; + + +fn run_client(config: &str) -> Output { + let out_dir = env::var("OUT_DIR").expect("expected OUT_DIR environment variable"); + let bin_dir = Path::new(&out_dir).parent().unwrap().parent().unwrap().parent().unwrap(); + + Command::new(format!("{}/sota_client", bin_dir.to_str().unwrap())) + .arg("--print") + .arg(format!("--config={}", config)) + .output() + .unwrap_or_else(|err| panic!("couldn't start client: {}", err)) +} + + +#[test] +fn default_config() { + assert!(run_client("tests/toml/default.toml").status.success()); +} + +#[test] +fn genivi_config() { + assert!(run_client("tests/toml/genivi.toml").status.success()); +} + +#[test] +fn old_config() { + assert!(run_client("tests/toml/old.toml").status.success()); +} + +#[test] +fn polling_config() { + assert!(run_client("tests/toml/polling.toml").status.success() != true); +} |