From 19cec32415f40f104377789476beef33f2306bcf Mon Sep 17 00:00:00 2001 From: orhun Date: Mon, 12 Oct 2020 12:09:57 +0300 Subject: [PATCH] fix: Use CARGO_BIN_EXE instead of hardcoded path for tests --- tests/auth.rs | 5 ++--- tests/filters.rs | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/auth.rs b/tests/auth.rs index 1e1c89d..f46c7c7 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -8,7 +8,6 @@ use std::process::Command; use std::process::Stdio; use std::sync::Once; -const SUCKIT: &'static str = "target/debug/suckit"; const ADDR: &'static str = "http://0.0.0.0:8000"; static START: Once = Once::new(); @@ -27,7 +26,7 @@ fn test_auth() { // Shouldn't supply credentials to a non-matching host fn auth_different_host() { let output_dir = "w4"; - let mut cmd = Command::new(SUCKIT) + let mut cmd = Command::new(env!("CARGO_BIN_EXE_suckit")) .args(&[ ADDR, "-o", @@ -54,7 +53,7 @@ fn auth_different_host() { // Should authenticate with credentials to host (defaulting to origin host) fn auth_valid() { let output_dir = "w5"; - let mut cmd = Command::new(SUCKIT) + let mut cmd = Command::new(env!("CARGO_BIN_EXE_suckit")) .args(&[ADDR, "-o", "w5", "-a", "username password", "-j", "16"]) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) diff --git a/tests/filters.rs b/tests/filters.rs index d730b11..9bfb608 100644 --- a/tests/filters.rs +++ b/tests/filters.rs @@ -8,7 +8,6 @@ use std::process::Command; use std::process::Stdio; use std::sync::Once; -const SUCKIT: &'static str = "target/debug/suckit"; const ADDR: &'static str = "http://0.0.0.0:8000"; static START: Once = Once::new(); @@ -28,7 +27,7 @@ fn test_include_exclude() { // Test to use include flag for downloading pages only matching the given pattern. fn include_filter() { let output_dir = "w2"; - let mut cmd = Command::new(SUCKIT) + let mut cmd = Command::new(env!("CARGO_BIN_EXE_suckit")) .args(&[ADDR, "-o", "w2", "-i", "mp[3-4]", "-j", "16"]) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) @@ -49,7 +48,7 @@ fn include_filter() { // Test demonstrating usage of multiple include patterns for downloading pages only matching the given pattern. fn include_multiple_filters() { let output_dir = "w1"; - let mut cmd = Command::new(SUCKIT) + let mut cmd = Command::new(env!("CARGO_BIN_EXE_suckit")) .args(&[ADDR, "-o", output_dir, "-i", "(mp[3-4])|(txt)", "-j", "16"]) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) @@ -68,7 +67,7 @@ fn include_multiple_filters() { // Test to use exclude flag for excluding pages matching the given pattern. fn exclude_filter() { let output_dir = "w3"; - let mut cmd = Command::new(SUCKIT) + let mut cmd = Command::new(env!("CARGO_BIN_EXE_suckit")) .args(&[ADDR, "-o", output_dir, "-e", "jpe?g", "-j", "16"]) .stdout(Stdio::inherit()) .stderr(Stdio::inherit())