mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 21:58:20 +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]
|
#[inline]
|
||||||
fn from_native(native: Self::Native) -> Self {
|
fn from_native(native: Self::Native) -> Self {
|
||||||
native.try_into().expect(concat!(
|
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),
|
stringify!($native_type),
|
||||||
|
"` to `",
|
||||||
stringify!($type),
|
stringify!($type),
|
||||||
|
"`)",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn to_native(self) -> Self::Native {
|
fn to_native(self) -> Self::Native {
|
||||||
self.try_into().expect(concat!(
|
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),
|
stringify!($type),
|
||||||
|
"` to `",
|
||||||
stringify!($native_type),
|
stringify!($native_type),
|
||||||
|
"`)",
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -588,7 +592,9 @@ mod inner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[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() {
|
fn test_to_native_panics() {
|
||||||
use std::{i32, u32};
|
use std::{i32, u32};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user