mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-26 13:12:04 +00:00
also assert_invalid fixture type
This commit is contained in:
@ -24,6 +24,12 @@ fn setup_program(base_dir: &str, test_module_path: &str) -> (ProgramInstance, Ar
|
||||
(program, module_instance)
|
||||
}
|
||||
|
||||
fn try_load(base_dir: &str, module_path: &str) -> Result<parity_wasm::elements::Module, parity_wasm::elements::Error> {
|
||||
let mut wasm_path = PathBuf::from(base_dir.clone());
|
||||
wasm_path.push(module_path);
|
||||
parity_wasm::deserialize_file(&wasm_path)
|
||||
}
|
||||
|
||||
fn runtime_value(test_val: &test::RuntimeValue) -> parity_wasm::RuntimeValue {
|
||||
match test_val.value_type.as_ref() {
|
||||
"i32" => {
|
||||
@ -130,6 +136,17 @@ pub fn spec(name: &str) {
|
||||
println!("assert_trap at line {} - success ({:?})", line, e);
|
||||
}
|
||||
}
|
||||
},
|
||||
&test::Command::AssertInvalid { line, ref filename, .. } => {
|
||||
let module_load = try_load(&outdir, filename);
|
||||
match module_load {
|
||||
Ok(result) => {
|
||||
panic!("Expected invalid module definition, got some module!")
|
||||
},
|
||||
Err(e) => {
|
||||
println!("assert_invalid at line {} - success ({:?})", line, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,12 @@ pub enum Command {
|
||||
action: Action,
|
||||
text: String,
|
||||
},
|
||||
#[serde(rename = "assert_invalid")]
|
||||
AssertInvalid {
|
||||
line: u64,
|
||||
filename: String,
|
||||
text: String,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
|
Reference in New Issue
Block a user