mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-28 08:01:33 +00:00
test(interface-types) Test when lowering or lifting fails because of the value.
This commit is contained in:
@ -13,11 +13,11 @@ macro_rules! lowering_lifting {
|
|||||||
.push(InterfaceValue::$to_variant(value.try_into().map_err(
|
.push(InterfaceValue::$to_variant(value.try_into().map_err(
|
||||||
|_| {
|
|_| {
|
||||||
concat!(
|
concat!(
|
||||||
"Failed to cast ",
|
"Failed to cast `",
|
||||||
stringify!($from_variant),
|
stringify!($from_variant),
|
||||||
" to ",
|
"` to `",
|
||||||
stringify!($to_variant),
|
stringify!($to_variant),
|
||||||
"."
|
"`."
|
||||||
).to_string()
|
).to_string()
|
||||||
},
|
},
|
||||||
)?))
|
)?))
|
||||||
@ -98,6 +98,14 @@ mod tests {
|
|||||||
stack: [InterfaceValue::S8(42)],
|
stack: [InterfaceValue::S8(42)],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test_executable_instruction!(
|
||||||
|
test_convert_fails =
|
||||||
|
instructions: [Instruction::ArgumentGet { index: 0}, Instruction::I32ToS8],
|
||||||
|
invocation_inputs: [InterfaceValue::I32(128)],
|
||||||
|
instance: Instance::new(),
|
||||||
|
error: "Failed to cast `I32` to `S8`."
|
||||||
|
);
|
||||||
|
|
||||||
test_executable_instruction!(
|
test_executable_instruction!(
|
||||||
test_type_mismatch =
|
test_type_mismatch =
|
||||||
instructions: [Instruction::ArgumentGet { index: 0}, Instruction::I32ToS8],
|
instructions: [Instruction::ArgumentGet { index: 0}, Instruction::I32ToS8],
|
||||||
|
Reference in New Issue
Block a user