mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 21:28:21 +00:00
test(api) Fix test about FromToNativeWasmType.
This commit is contained in:
12
lib/api/src/externals/function.rs
vendored
12
lib/api/src/externals/function.rs
vendored
@@ -546,18 +546,22 @@ mod inner {
|
||||
#[inline]
|
||||
fn from_native(native: Self::Native) -> Self {
|
||||
native.try_into().expect(concat!(
|
||||
"out of range type conversion attempt (tried to convert `{}` to `{}`)",
|
||||
"out of range type conversion attempt (tried to convert `",
|
||||
stringify!($native_type),
|
||||
"` to `",
|
||||
stringify!($type),
|
||||
"`)",
|
||||
))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn to_native(self) -> Self::Native {
|
||||
self.try_into().expect(concat!(
|
||||
"out of range type conversion attempt (tried to convert `{}` to `{}`)",
|
||||
"out of range type conversion attempt (tried to convert `",
|
||||
stringify!($type),
|
||||
"` to `",
|
||||
stringify!($native_type),
|
||||
"`)",
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -588,7 +592,9 @@ mod inner {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "cannot convert 4294967295u32 to i32")]
|
||||
#[should_panic(
|
||||
expected = "out of range type conversion attempt (tried to convert `u32` to `i32`)"
|
||||
)]
|
||||
fn test_to_native_panics() {
|
||||
use std::{i32, u32};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user