Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CARGO_BIN_EXE instead of hardcoded path for tests #98

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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