test(api) Fix test about FromToNativeWasmType.

This commit is contained in:
Ivan Enderlin
2020-07-02 17:19:54 +02:00
parent 8c937d3db4
commit ea78fe5fa4

View File

@@ -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};