Skip to content

Commit

Permalink
Revert "[sc-487] Add test for hvmc compile (#76)"
Browse files Browse the repository at this point in the history
This reverts commit 2a338a9.
  • Loading branch information
FranchuFranchu authored Mar 4, 2024
1 parent 2a338a9 commit 8040cee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 38 deletions.
7 changes: 3 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ fn compile_executable(file_name: &str, host: &host::Host) -> Result<(), io::Erro
}

let output = process::Command::new("cargo")
.current_dir(".hvm")
.current_dir("./.hvm")
.arg("build")
.arg("--release")
.stderr(Stdio::inherit())
Expand All @@ -327,9 +327,8 @@ fn compile_executable(file_name: &str, host: &host::Host) -> Result<(), io::Erro
process::exit(1);
}

let target = format!("{}", file_name.strip_suffix(".hvmc").unwrap_or(file_name));

fs::copy(".hvm/target/release/hvmc", target)?;
let target = format!("./{}", file_name.strip_suffix(".hvmc").unwrap_or(file_name));
fs::copy("./.hvm/target/release/hvmc", target)?;

Ok(())
}
34 changes: 0 additions & 34 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::{
error::Error,
io::Read,
path::PathBuf,
process::{Command, ExitStatus, Stdio},
};

Expand Down Expand Up @@ -184,36 +183,3 @@ fn test_apply_tree() {
@"(<2* a> a)"
);
}

#[test]
fn test_cli_compile() {
// Test normal-form expressions

if !Command::new(env!("CARGO_BIN_EXE_hvmc"))
.args(&["compile", &get_arithmetic_program_path()])
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
.unwrap()
.wait()
.unwrap()
.success()
{
panic!("{:?}", "compilation failed");
};

let mut output_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
output_path.push("examples/arithmetic");
let mut child = Command::new(&output_path).args(&["#40", "#3"]).stdout(Stdio::piped()).spawn().unwrap();

let mut stdout = child.stdout.take().ok_or("Couldn't capture stdout!").unwrap();
child.wait().unwrap();
let mut output = String::new();
stdout.read_to_string(&mut output).unwrap();

assert_display_snapshot!(output, @r###"
[#13 #1]
"###);

std::fs::remove_file(&output_path).unwrap();
}

0 comments on commit 8040cee

Please sign in to comment.