mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +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]**
|
||||
|
||||
- [#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.
|
||||
- [#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.
|
||||
|
@ -266,12 +266,14 @@ mod test {
|
||||
|
||||
imports1.extend(imports2);
|
||||
|
||||
let cat_ns = imports1.get_namespace("cat").unwrap();
|
||||
assert!(cat_ns.get_export("small").is_some());
|
||||
let small_cat_export =
|
||||
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();
|
||||
assert!(dog_ns.get_export("happy").is_some());
|
||||
assert!(dog_ns.get_export("small").is_some());
|
||||
let entries = imports1.maybe_with_namespace("dog", |dog_ns| {
|
||||
Some((dog_ns.get_export("happy")?, dog_ns.get_export("small")?))
|
||||
});
|
||||
assert!(entries.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -289,14 +291,14 @@ mod test {
|
||||
};
|
||||
|
||||
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!(
|
||||
if let Export::Global(happy_dog_global) = dog_ns.get_export("happy").unwrap() {
|
||||
assert!(if let Export::Global(happy_dog_global) = happy_dog_entry {
|
||||
happy_dog_global.get() == Value::I32(4)
|
||||
} else {
|
||||
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