bump wabt version to 0.4

It has some interface changes.
This commit is contained in:
Guanqun Lu 2018-07-30 08:34:58 +00:00
parent 9ed95e49c1
commit eae7fc786f
2 changed files with 12 additions and 5 deletions

View File

@ -18,4 +18,4 @@ nan-preserving-float = "0.1.0"
[dev-dependencies]
assert_matches = "1.1"
wabt = "0.3"
wabt = "0.4"

View File

@ -1,5 +1,6 @@
#![cfg(test)]
use std::fs::File;
use std::collections::HashMap;
use wabt::script::{self, Action, Command, CommandKind, ScriptParser, Value};
@ -340,7 +341,13 @@ pub fn spec(name: &str) {
fn try_spec(name: &str) -> Result<(), Error> {
let mut spec_driver = SpecDriver::new();
let spec_script_path = format!("tests/spec/testsuite/{}.wast", name);
let mut parser = ScriptParser::from_file(spec_script_path).expect("Can't read spec script");
use std::io::Read;
let mut spec_source = Vec::new();
let mut spec_file = File::open(&spec_script_path).expect("Can't open the file");
spec_file.read_to_end(&mut spec_source).expect("Can't read file");
let mut parser = ScriptParser::from_source_and_name(&spec_source, &format!("{}.wast", name)).expect("Can't read spec script");
let mut errors = vec![];
while let Some(Command { kind, line }) = parser.next()? {
@ -364,7 +371,7 @@ fn try_spec(name: &str) -> Result<(), Error> {
match kind {
CommandKind::Module { name, module, .. } => {
load_module(&module.into_vec()?, &name, &mut spec_driver)
load_module(&module.into_vec(), &name, &mut spec_driver)
.expect("Failed to load module");
}
CommandKind::AssertReturn { action, expected } => {
@ -446,14 +453,14 @@ fn try_spec(name: &str) -> Result<(), Error> {
CommandKind::AssertInvalid { module, .. }
| CommandKind::AssertMalformed { module, .. }
| CommandKind::AssertUnlinkable { module, .. } => {
let module_load = try_load(&module.into_vec()?, &mut spec_driver);
let module_load = try_load(&module.into_vec(), &mut spec_driver);
match module_load {
Ok(_) => panic!("Expected invalid module definition, got some module!"),
Err(_e) => {},
}
}
CommandKind::AssertUninstantiable { module, .. } => {
match try_load(&module.into_vec()?, &mut spec_driver) {
match try_load(&module.into_vec(), &mut spec_driver) {
Ok(_) => panic!("Expected error running start function at line {}", line),
Err(_e) => {},
}