mirror of
https://github.com/fluencelabs/interface-types
synced 2024-12-04 23:30:19 +00:00
test(interface-types) Test when lowering or lifting fails because of the value.
This commit is contained in:
parent
cac6b4ae01
commit
c617b1fa16
@ -13,11 +13,11 @@ macro_rules! lowering_lifting {
|
||||
.push(InterfaceValue::$to_variant(value.try_into().map_err(
|
||||
|_| {
|
||||
concat!(
|
||||
"Failed to cast ",
|
||||
"Failed to cast `",
|
||||
stringify!($from_variant),
|
||||
" to ",
|
||||
"` to `",
|
||||
stringify!($to_variant),
|
||||
"."
|
||||
"`."
|
||||
).to_string()
|
||||
},
|
||||
)?))
|
||||
@ -98,6 +98,14 @@ mod tests {
|
||||
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_type_mismatch =
|
||||
instructions: [Instruction::ArgumentGet { index: 0}, Instruction::I32ToS8],
|
||||
|
Loading…
Reference in New Issue
Block a user