fix side-effects in tutorial test
This commit is contained in:
parent
99301d7521
commit
eca5c400a9
2 changed files with 15 additions and 16 deletions
|
@ -37,6 +37,7 @@ sha2 = "0.10.0"
|
|||
glob = "0.2.11"
|
||||
assert_cli = "0.5"
|
||||
tempdir = "0.3"
|
||||
fs_extra = "1.1.0"
|
||||
|
||||
[build-dependencies]
|
||||
fs_extra = "1.1.0"
|
||||
|
|
|
@ -4,7 +4,8 @@ extern crate serde_json;
|
|||
#[cfg(test)]
|
||||
mod integration {
|
||||
|
||||
use glob::glob;
|
||||
use fs_extra::copy_items;
|
||||
use fs_extra::dir::CopyOptions;
|
||||
use serde_json::from_reader;
|
||||
use std::fs;
|
||||
use std::fs::File;
|
||||
|
@ -408,16 +409,15 @@ mod integration {
|
|||
let tmp_dir = TempDir::new(".tmp").unwrap();
|
||||
let tmp_base = tmp_dir.path();
|
||||
|
||||
for g in glob("./examples/book/rng_tutorial/*").expect("Failed to read glob pattern") {
|
||||
let path = g.unwrap();
|
||||
std::fs::hard_link(path.clone(), tmp_base.join(path.file_name().unwrap())).unwrap();
|
||||
}
|
||||
let mut options = CopyOptions::new();
|
||||
options.copy_inside = true;
|
||||
copy_items(&["examples/book/rng_tutorial"], tmp_base, &options).unwrap();
|
||||
|
||||
let stdlib = std::fs::canonicalize("../zokrates_stdlib/stdlib").unwrap();
|
||||
let binary_path = env!("CARGO_BIN_EXE_zokrates");
|
||||
|
||||
assert_cli::Assert::command(&["./test.sh", binary_path, stdlib.to_str().unwrap()])
|
||||
.current_dir(tmp_base)
|
||||
.current_dir(tmp_base.join("rng_tutorial"))
|
||||
.succeeds()
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -428,16 +428,15 @@ mod integration {
|
|||
let tmp_dir = TempDir::new(".tmp").unwrap();
|
||||
let tmp_base = tmp_dir.path();
|
||||
|
||||
for g in glob("./examples/book/sha256_tutorial/*").expect("Failed to read glob pattern") {
|
||||
let path = g.unwrap();
|
||||
std::fs::hard_link(path.clone(), tmp_base.join(path.file_name().unwrap())).unwrap();
|
||||
}
|
||||
let mut options = CopyOptions::new();
|
||||
options.copy_inside = true;
|
||||
copy_items(&["examples/book/sha256_tutorial"], tmp_base, &options).unwrap();
|
||||
|
||||
let stdlib = std::fs::canonicalize("../zokrates_stdlib/stdlib").unwrap();
|
||||
let binary_path = env!("CARGO_BIN_EXE_zokrates");
|
||||
|
||||
assert_cli::Assert::command(&["./test.sh", binary_path, stdlib.to_str().unwrap()])
|
||||
.current_dir(tmp_base)
|
||||
.current_dir(tmp_base.join("sha256_tutorial"))
|
||||
.succeeds()
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -448,16 +447,15 @@ mod integration {
|
|||
let tmp_dir = TempDir::new(".tmp").unwrap();
|
||||
let tmp_base = tmp_dir.path();
|
||||
|
||||
for g in glob("./examples/book/mpc_tutorial/**/*").expect("Failed to read glob pattern") {
|
||||
let path = g.unwrap();
|
||||
std::fs::hard_link(path.clone(), tmp_base.join(path.file_name().unwrap())).unwrap();
|
||||
}
|
||||
let mut options = CopyOptions::new();
|
||||
options.copy_inside = true;
|
||||
copy_items(&["examples/book/mpc_tutorial"], tmp_base, &options).unwrap();
|
||||
|
||||
let stdlib = std::fs::canonicalize("../zokrates_stdlib/stdlib").unwrap();
|
||||
let binary_path = env!("CARGO_BIN_EXE_zokrates");
|
||||
|
||||
assert_cli::Assert::command(&["./test.sh", binary_path, stdlib.to_str().unwrap()])
|
||||
.current_dir(tmp_base)
|
||||
.current_dir(tmp_base.join("mpc_tutorial"))
|
||||
.succeeds()
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue