1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pub mod core;
pub use self::core::*;

pub mod idx;
pub mod instr;
pub mod module;
pub mod section;
pub mod ty;

#[cfg(test)]
mod test {
    use crate::grammar::*;

    #[test]
    fn can_deserialize_was_file() {
        let mut iter = [
            0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x85, 0x80, 0x80, 0x80, 0x00, 0x01, 0x60,
            0x00, 0x01, 0x7f, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x04, 0x84, 0x80, 0x80, 0x80,
            0x00, 0x01, 0x70, 0x00, 0x00, 0x06, 0x81, 0x80, 0x80, 0x80, 0x00, 0x00, 0x07, 0x88, 0x80, 0x80,
            0x80, 0x00, 0x01, 0x04, 0x74, 0x65, 0x73, 0x74, 0x00, 0x00, 0x0a, 0x8a, 0x80, 0x80, 0x80, 0x00,
            0x01, 0x84, 0x80, 0x80, 0x80, 0x00, 0x00, 0x41, 0x2a, 0x0b,
        ].iter().copied();
        let _result: module::Module = deserialize(&mut iter).unwrap();
        // TODO: write an assertion
    }
}