Skip to content

Commit

Permalink
Compile in temp for integration tests (PLC-lang#240)
Browse files Browse the repository at this point in the history
Avoid infinite loop while compiling the integration tests
by using a temp folder.
  • Loading branch information
ghaith authored Aug 13, 2021
1 parent c1b8d82 commit 2966359
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/integration/external_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use rusty::{FilePath, compile_to_bitcode, compile_to_ir, compile_to_shared_objec

fn compile_all(name : &str, encoding : Option<&'static Encoding>) {
let path = get_file(name);
let out = format!("{}.out", &path);
let mut out = env::temp_dir();
let out_name = format!("{}.out", &name);
out.push(out_name);
let out = out.into_os_string().into_string().unwrap();
compile_to_ir(vec![FilePath{path : path.clone()}], encoding, &out).unwrap();
fs::remove_file(&out).unwrap();
compile_to_bitcode(vec![FilePath{path : path.clone()}], encoding, &out).unwrap();
Expand All @@ -35,13 +38,11 @@ fn get_file(name : &str) -> String {

}

#[ignore = "ends in endless build in cargo watch"]
#[test]
fn compile_external_file() {
compile_all("test_file.st", None);
}

#[ignore = "ends in endless build in cargo watch"]
#[test]
fn compile_external_file_with_encoding() {
compile_all("encoding_utf_16.st", None);
Expand Down

0 comments on commit 2966359

Please sign in to comment.