Skip to content

Commit

Permalink
fix: Use CARGO_BIN_EXE instead of hardcoded path for tests (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun authored Oct 12, 2020
1 parent 5705175 commit d9c17d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions tests/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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",
Expand All @@ -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())
Expand Down
7 changes: 3 additions & 4 deletions tests/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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())
Expand All @@ -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())
Expand All @@ -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())
Expand Down

0 comments on commit d9c17d9

Please sign in to comment.