1
0
mirror of https://github.com/fluencelabs/wasmer synced 2025-03-31 23:11:04 +00:00

test(interface-types) Test adapter to binary.

This commit is contained in:
Ivan Enderlin 2020-02-26 15:38:59 +01:00
parent 4b7cd3a875
commit 3653c42e23

@ -104,7 +104,7 @@ fn string<'input, E: ParseError<&'input [u8]>>(
)) ))
} }
/// Parse a list, with a item parser. /// Parse a list, with an item parser.
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
fn list<'input, I, E: ParseError<&'input [u8]>>( fn list<'input, I, E: ParseError<&'input [u8]>>(
input: &'input [u8], input: &'input [u8],
@ -802,54 +802,24 @@ mod tests {
assert_eq!(imports::<()>(input), output); assert_eq!(imports::<()>(input), output);
} }
/*
#[test] #[test]
fn test_adapters() { fn test_adapters() {
let input = &[ let input = &[
0x02, // 3 adapters 0x01, // 1 adapters
0x00, // adapter kind: import 0x00, // function type
0x01, // string of 1 byte
0x61, // "a"
0x01, // string of 1 byte
0x62, // "b"
0x01, // list of 1 item
0x0c, // I32
0x01, // list of 1 item
0x0c, // I32
0x01, // list of 1 item
0x00, 0x01, // ArgumentGet { index: 1 }
0x01, // adapter kind: export
0x01, // string of 1 byte
0x63, // "c"
0x01, // list of 1 item
0x0c, // I32
0x01, // list of 1 item
0x0c, // I32
0x01, // list of 1 item 0x01, // list of 1 item
0x00, 0x01, // ArgumentGet { index: 1 } 0x00, 0x01, // ArgumentGet { index: 1 }
]; ];
let output = Ok(( let output = Ok((
&[] as &[u8], &[] as &[u8],
vec![ vec![Adapter {
Adapter::Import { function_type: 0,
namespace: "a", instructions: vec![Instruction::ArgumentGet { index: 1 }],
name: "b", }],
input_types: vec![InterfaceType::I32],
output_types: vec![InterfaceType::I32],
instructions: vec![Instruction::ArgumentGet { index: 1 }],
},
Adapter::Export {
name: "c",
input_types: vec![InterfaceType::I32],
output_types: vec![InterfaceType::I32],
instructions: vec![Instruction::ArgumentGet { index: 1 }],
},
],
)); ));
assert_eq!(adapters::<()>(input), output); assert_eq!(adapters::<()>(input), output);
} }
*/
#[test] #[test]
fn test_parse() { fn test_parse() {