Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Nov 20, 2022
1 parent 0d7f10f commit 2f48a3c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions lib/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,7 @@ fn wasmer_main_inner() -> Result<(), anyhow::Error> {
let debug = false;
#[cfg(feature = "debug")]
let debug = r.options.debug;
#[cfg(test)]
let result = crate::commands::try_run_package_or_file("wasmer_main_inner", &args, r, debug);
#[cfg(not(test))]
let result = crate::commands::try_run_package_or_file(&args, r, debug);
return result;
return crate::commands::try_run_package_or_file(&args, r, debug);
}

options.execute()
Expand Down
1 change: 1 addition & 0 deletions lib/cli/src/commands/login.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use clap::Parser;
#[cfg(not(test))]
use dialoguer::Input;

/// Subcommand for listing packages
Expand Down
12 changes: 1 addition & 11 deletions lib/cli/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,17 +822,13 @@ fn test_fixup_args() {
}

pub(crate) fn try_run_package_or_file(
#[cfg(test)] test_name: &str,
args: &[String],
r: &Run,
debug: bool,
) -> Result<(), anyhow::Error> {
let debug_msgs_allowed = isatty::stdout_isatty();

if let Ok(url) = url::Url::parse(&format!("{}", r.path.display())) {
#[cfg(test)]
let result = try_run_url(test_name, &url, args, r, debug);
#[cfg(not(test))]
let result = try_run_url(&url, args, r, debug);
return result;
}
Expand Down Expand Up @@ -919,13 +915,7 @@ pub(crate) fn try_run_package_or_file(
try_autoinstall_package(args, &sv, package_download_info, r.force_install)
}

fn try_run_url(
#[cfg(test)] test_name: &str,
url: &Url,
_args: &[String],
r: &Run,
_debug: bool,
) -> Result<(), anyhow::Error> {
fn try_run_url(url: &Url, _args: &[String], r: &Run, _debug: bool) -> Result<(), anyhow::Error> {
let checksum = wasmer_registry::get_remote_webc_checksum(url)
.map_err(|e| anyhow::anyhow!("error fetching {url}: {e}"))?;

Expand Down

0 comments on commit 2f48a3c

Please sign in to comment.