diff options
author | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2019-12-30 22:39:49 -0500 |
---|---|---|
committer | Clement Tsang <34804052+ClementTsang@users.noreply.github.com> | 2019-12-30 22:39:49 -0500 |
commit | d0a7a0dd72b6b23995a725fd460f2d97b6eff11e (patch) | |
tree | 6bbe69adefe92173469fdf783b4db0783ae767d0 /tests | |
parent | feeca2b2584bcca4822334d18d47894f9deffe84 (diff) |
Quick error change for processes to be a bit more graceful, fix tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arg_rate_tests.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/arg_rate_tests.rs b/tests/arg_rate_tests.rs index 6f71325a..a32e1b76 100644 --- a/tests/arg_rate_tests.rs +++ b/tests/arg_rate_tests.rs @@ -6,9 +6,21 @@ use std::process::Command; //======================RATES======================// +fn get_os_binary_loc() -> String { + if cfg!(target_os = "linux") { + "./target/x86_64-unknown-linux-gnu/debug/btm".to_string() + } else if cfg!(target_os = "windows") { + "./target/x86_64-pc-windows-msvc/debug/btm".to_string() + } else if cfg!(target_os = "macos") { + "./target/x86_64-apple-darwin/debug/btm".to_string() + } else { + "".to_string() + } +} + #[test] fn test_small_rate() -> Result<(), Box<dyn std::error::Error>> { - Command::new("./target/debug/btm") + Command::new(get_os_binary_loc()) .arg("-r") .arg("249") .assert() @@ -19,7 +31,7 @@ fn test_small_rate() -> Result<(), Box<dyn std::error::Error>> { #[test] fn test_large_rate() -> Result<(), Box<dyn std::error::Error>> { - Command::new("./target/debug/btm") + Command::new(get_os_binary_loc()) .arg("-r") .arg("18446744073709551616") .assert() @@ -31,7 +43,7 @@ fn test_large_rate() -> Result<(), Box<dyn std::error::Error>> { #[test] fn test_negative_rate() -> Result<(), Box<dyn std::error::Error>> { // This test should auto fail due to how clap works - Command::new("./target/debug/btm") + Command::new(get_os_binary_loc()) .arg("-r") .arg("-1000") .assert() @@ -43,7 +55,7 @@ fn test_negative_rate() -> Result<(), Box<dyn std::error::Error>> { #[test] fn test_invalid_rate() -> Result<(), Box<dyn std::error::Error>> { - Command::new("./target/debug/btm") + Command::new(get_os_binary_loc()) .arg("-r") .arg("100-1000") .assert() |