Improved tests readability

This commit is contained in:
Syrus Akbary
2021-07-12 23:14:23 -07:00
parent 87ae2ffbde
commit 226f985dc1
3 changed files with 22 additions and 570 deletions

View File

@@ -2,43 +2,6 @@ use anyhow::Result;
use wasm_bindgen_test::*;
use wasmer_js::*;
// #[test]
// fn exports_work_after_multiple_instances_have_been_freed() -> Result<()> {
// let store = Store::default();
// let module = Module::new(
// &store,
// "
// (module
// (type $sum_t (func (param i32 i32) (result i32)))
// (func $sum_f (type $sum_t) (param $x i32) (param $y i32) (result i32)
// local.get $x
// local.get $y
// i32.add)
// (export \"sum\" (func $sum_f)))
// ",
// )?;
// let import_object = ImportObject::new();
// let instance = Instance::new(&module, &import_object)?;
// let instance2 = instance.clone();
// let instance3 = instance.clone();
// // The function is cloned to “break” the connection with `instance`.
// let sum = instance.exports.get_function("sum")?.clone();
// drop(instance);
// drop(instance2);
// drop(instance3);
// // All instances have been dropped, but `sum` continues to work!
// assert_eq!(
// sum.call(&[Value::I32(1), Value::I32(2)])?.into_vec(),
// vec![Value::I32(3)],
// );
// Ok(())
// }
#[wasm_bindgen_test]
fn test_exported_memory() {
let store = Store::default();
@@ -95,10 +58,6 @@ fn test_exported_function() {
let import_object = imports! {};
let instance = Instance::new(&module, &import_object).unwrap();
// let memory = instance.exports.get_memory("mem").unwrap();
// assert_eq!(memory.size(), Pages(1));
// assert_eq!(memory.data_size(), 65536);
let get_magic = instance.exports.get_function("get_magic").unwrap();
assert_eq!(
get_magic.ty().clone(),
@@ -199,10 +158,6 @@ fn test_imported_function_native() {
};
let instance = Instance::new(&module, &import_object).unwrap();
// let memory = instance.exports.get_memory("mem").unwrap();
// assert_eq!(memory.size(), Pages(1));
// assert_eq!(memory.data_size(), 65536);
let exported = instance.exports.get_function("exported").unwrap();
let expected = vec![Val::I32(5)].into_boxed_slice();
@@ -253,10 +208,6 @@ fn test_imported_function_native_with_env() {
};
let instance = Instance::new(&module, &import_object).unwrap();
// let memory = instance.exports.get_memory("mem").unwrap();
// assert_eq!(memory.size(), Pages(1));
// assert_eq!(memory.data_size(), 65536);
let exported = instance.exports.get_function("exported").unwrap();
let expected = vec![Val::I32(12)].into_boxed_slice();