mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 21:28:21 +00:00
test(api) Add tests for the FromToNativeWasmType trait.
This commit is contained in:
18
lib/api/src/externals/function.rs
vendored
18
lib/api/src/externals/function.rs
vendored
@@ -581,6 +581,24 @@ mod inner {
|
||||
f64 => f64
|
||||
);
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_from_to_native_wasm_type {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_to_native() {
|
||||
assert_eq!(7i8.to_native(), 7i32);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "cannot convert 4294967295u32 to i32")]
|
||||
fn test_to_native_panics() {
|
||||
use std::{i32, u32};
|
||||
|
||||
assert_eq!(u32::MAX.to_native(), i32::MAX);
|
||||
}
|
||||
}
|
||||
|
||||
/// The `WasmTypeList` trait represents a tuple (list) of Wasm
|
||||
/// typed values. It is used to get low-level representation of
|
||||
/// such a tuple.
|
||||
|
||||
Reference in New Issue
Block a user