Bump wabt's version to 0.4 and add two more test cases (#114)
* bump wabt version to 0.4 It has some interface changes. * bump up testsuite and add two more test cases * use the same expect string
This commit is contained in:
parent
43b8d52bca
commit
5c86c1c753
|
@ -18,4 +18,4 @@ nan-preserving-float = "0.1.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_matches = "1.1"
|
assert_matches = "1.1"
|
||||||
wabt = "0.3"
|
wabt = "0.4"
|
||||||
|
|
|
@ -22,7 +22,9 @@ run_test!("call_indirect", wasm_call_indirect);
|
||||||
run_test!("comments", wasm_comments);
|
run_test!("comments", wasm_comments);
|
||||||
run_test!("const", wasm_const);
|
run_test!("const", wasm_const);
|
||||||
run_test!("conversions", wasm_conversions);
|
run_test!("conversions", wasm_conversions);
|
||||||
|
run_test!("custom", wasm_custom);
|
||||||
run_test!("custom_section", wasm_custom_section);
|
run_test!("custom_section", wasm_custom_section);
|
||||||
|
run_test!("data", wasm_data);
|
||||||
run_test!("elem", wasm_elem);
|
run_test!("elem", wasm_elem);
|
||||||
run_test!("endianness", wasm_endianness);
|
run_test!("endianness", wasm_endianness);
|
||||||
run_test!("exports", wasm_exports);
|
run_test!("exports", wasm_exports);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
|
|
||||||
|
use std::fs::File;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use wabt::script::{self, Action, Command, CommandKind, ScriptParser, Value};
|
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> {
|
fn try_spec(name: &str) -> Result<(), Error> {
|
||||||
let mut spec_driver = SpecDriver::new();
|
let mut spec_driver = SpecDriver::new();
|
||||||
let spec_script_path = format!("tests/spec/testsuite/{}.wast", name);
|
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 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![];
|
let mut errors = vec![];
|
||||||
|
|
||||||
while let Some(Command { kind, line }) = parser.next()? {
|
while let Some(Command { kind, line }) = parser.next()? {
|
||||||
|
@ -364,7 +371,7 @@ fn try_spec(name: &str) -> Result<(), Error> {
|
||||||
|
|
||||||
match kind {
|
match kind {
|
||||||
CommandKind::Module { name, module, .. } => {
|
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");
|
.expect("Failed to load module");
|
||||||
}
|
}
|
||||||
CommandKind::AssertReturn { action, expected } => {
|
CommandKind::AssertReturn { action, expected } => {
|
||||||
|
@ -446,14 +453,14 @@ fn try_spec(name: &str) -> Result<(), Error> {
|
||||||
CommandKind::AssertInvalid { module, .. }
|
CommandKind::AssertInvalid { module, .. }
|
||||||
| CommandKind::AssertMalformed { module, .. }
|
| CommandKind::AssertMalformed { module, .. }
|
||||||
| CommandKind::AssertUnlinkable { 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 {
|
match module_load {
|
||||||
Ok(_) => panic!("Expected invalid module definition, got some module!"),
|
Ok(_) => panic!("Expected invalid module definition, got some module!"),
|
||||||
Err(_e) => {},
|
Err(_e) => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommandKind::AssertUninstantiable { module, .. } => {
|
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),
|
Ok(_) => panic!("Expected error running start function at line {}", line),
|
||||||
Err(_e) => {},
|
Err(_e) => {},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c538faa43217146f458b9bc2d4b704d0a4d80963
|
Subproject commit c6a690f89a0dda3c79700aa6377d8b5d8a970eba
|
Loading…
Reference in New Issue