mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 18:32:15 +00:00
Add test for Instance, fix tests for ImportObject
This commit is contained in:
parent
9c205e05a2
commit
05ad1aaea4
@ -6,6 +6,7 @@ Blocks of changes will separated by version increments.
|
|||||||
|
|
||||||
## **[Unreleased]**
|
## **[Unreleased]**
|
||||||
|
|
||||||
|
- [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace`
|
||||||
- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model.
|
- [#790](https://github.com/wasmerio/wasmer/pull/790) Fix flaky test failure with LLVM, switch to large code model.
|
||||||
- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file.
|
- [#788](https://github.com/wasmerio/wasmer/pull/788) Use union merge on the changelog file.
|
||||||
- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests.
|
- [#785](https://github.com/wasmerio/wasmer/pull/785) Include Apache license file for spectests.
|
||||||
|
@ -266,12 +266,14 @@ mod test {
|
|||||||
|
|
||||||
imports1.extend(imports2);
|
imports1.extend(imports2);
|
||||||
|
|
||||||
let cat_ns = imports1.get_namespace("cat").unwrap();
|
let small_cat_export =
|
||||||
assert!(cat_ns.get_export("small").is_some());
|
imports1.maybe_with_namespace("cat", |cat_ns| cat_ns.get_export("small"));
|
||||||
|
assert!(small_cat_export.is_some());
|
||||||
|
|
||||||
let dog_ns = imports1.get_namespace("dog").unwrap();
|
let entries = imports1.maybe_with_namespace("dog", |dog_ns| {
|
||||||
assert!(dog_ns.get_export("happy").is_some());
|
Some((dog_ns.get_export("happy")?, dog_ns.get_export("small")?))
|
||||||
assert!(dog_ns.get_export("small").is_some());
|
});
|
||||||
|
assert!(entries.is_some());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -289,14 +291,14 @@ mod test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
imports1.extend(imports2);
|
imports1.extend(imports2);
|
||||||
let dog_ns = imports1.get_namespace("dog").unwrap();
|
let happy_dog_entry = imports1
|
||||||
|
.maybe_with_namespace("dog", |dog_ns| dog_ns.get_export("happy"))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
assert!(
|
assert!(if let Export::Global(happy_dog_global) = happy_dog_entry {
|
||||||
if let Export::Global(happy_dog_global) = dog_ns.get_export("happy").unwrap() {
|
happy_dog_global.get() == Value::I32(4)
|
||||||
happy_dog_global.get() == Value::I32(4)
|
} else {
|
||||||
} else {
|
false
|
||||||
false
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -752,3 +752,15 @@ impl<'a> DynFunc<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn is_send<T: Send>() {}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_instance_is_send() {
|
||||||
|
is_send::<Instance>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user