Skip to content

Commit

Permalink
Merge pull request #253 from Wodann/refactor/test
Browse files Browse the repository at this point in the history
refactor: move test utility functions to separate crate
  • Loading branch information
Wodann authored Aug 22, 2020
2 parents 0dcbed3 + 94b56b3 commit 3a6b437
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 236 deletions.
1 change: 1 addition & 0 deletions crates/mun_runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rustc-hash = "1.1"
compiler = { path="../mun_compiler", package = "mun_compiler" }
criterion = "0.3"
mlua = { package ="mlua", version="0.2", default-features = false, features=["vendored", "luajit"] }
mun_test = { path = "../mun_test" }
tempfile = "3"
termcolor = "1.1"
wasmer-runtime = "0.16"
Expand Down
14 changes: 9 additions & 5 deletions crates/mun_runtime/tests/hot_reloading.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#[macro_use]
mod util;

use util::*;
use mun_test::CompileAndRunTestDriver;

#[test]
fn hotreloadable() {
let mut driver = TestDriver::new(
let mut driver = CompileAndRunTestDriver::new(
r"
pub fn main() -> i32 { 5 }
",
);
|builder| builder,
)
.expect("Failed to build test driver");
assert_invoke_eq!(i32, 5, driver, "main");

let runtime = driver.runtime();
Expand All @@ -24,7 +26,7 @@ fn hotreloadable() {

#[test]
fn hotreload_struct_decl() {
let mut driver = TestDriver::new(
let mut driver = CompileAndRunTestDriver::new(
r#"
struct(gc) Args {
n: i32,
Expand All @@ -39,7 +41,9 @@ fn hotreload_struct_decl() {
Args { n: 3, foo: Bar { m: 1.0 }, }
}
"#,
);
|builder| builder,
)
.expect("Failed to build test driver");

let runtime = driver.runtime();
driver.update(
Expand Down
Loading

0 comments on commit 3a6b437

Please sign in to comment.