Skip to content

Commit e06f32e

Browse files
fix tests
1 parent 147f50e commit e06f32e

3 files changed

Lines changed: 13 additions & 82 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ default = []
2626
py = ["dep:pyo3", "dep:pyo3-async-runtimes"]
2727

2828
[dev-dependencies]
29-
assert_cmd = "2.1"
3029
[[bin]]
3130
name = "cloudcheck"
3231
path = "src/main.rs"

src/main.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,21 @@ async fn main() {
5959

6060
#[cfg(test)]
6161
mod tests {
62-
use assert_cmd::Command;
62+
use std::process::Command;
6363

6464
#[test]
6565
fn test_lookup_command_output() {
66-
let bin_path = std::env::var("CARGO_BIN_EXE_cloudcheck")
67-
.unwrap_or_else(|_| "target/debug/cloudcheck".to_string());
68-
let mut cmd = Command::from_std(std::process::Command::new(bin_path));
69-
let output = cmd.args(["lookup", "8.8.8.8"]).output().unwrap();
66+
let bin_path = std::env::var("CARGO_BIN_EXE_cloudcheck").unwrap_or_else(|_| {
67+
let profile = std::env::var("PROFILE").unwrap_or_else(|_| "debug".to_string());
68+
let mut path = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
69+
path.push("target");
70+
path.push(&profile);
71+
path.push("cloudcheck");
72+
path.to_string_lossy().to_string()
73+
});
74+
let mut cmd = Command::new(bin_path);
75+
cmd.args(["lookup", "8.8.8.8"]);
76+
let output = cmd.output().unwrap();
7077

7178
assert!(output.status.success());
7279

0 commit comments

Comments
 (0)