mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-11 23:07:29 +00:00
Old test uncommented
This commit is contained in:
parent
e9ec5e8aa8
commit
93b61bc2dc
@ -2,6 +2,7 @@ use elements::{MemoryType, TableType, GlobalType, Type};
|
||||
use elements::{BlockType, ValueType};
|
||||
use validation::Error;
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
pub struct ModuleContext {
|
||||
pub memories: Vec<MemoryType>,
|
||||
pub tables: Vec<TableType>,
|
||||
|
@ -16,6 +16,7 @@ mod func;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Error(String);
|
||||
|
||||
impl fmt::Display for Error {
|
||||
@ -182,8 +183,6 @@ fn prepare_context(module: &Module) -> Result<ModuleContext, Error> {
|
||||
.unwrap_or_default();
|
||||
|
||||
// Fill elements with imported values.
|
||||
|
||||
// TODO: Use Func::type_ref?
|
||||
let mut func_type_indexes = Vec::new();
|
||||
let mut tables = Vec::new();
|
||||
let mut memories = Vec::new();
|
||||
|
@ -1,5 +1,6 @@
|
||||
use elements::{MemoryType, TableType, GlobalType, Type};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ValidatedModule {
|
||||
pub memories: Vec<MemoryType>,
|
||||
pub tables: Vec<TableType>,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::validate_module;
|
||||
use builder::module;
|
||||
use elements::{External, GlobalEntry, GlobalType, ImportEntry, InitExpr, MemoryType,
|
||||
Opcode, Opcodes, TableType, ValueType};
|
||||
Opcode, Opcodes, TableType, ValueType, BlockType};
|
||||
|
||||
#[test]
|
||||
fn empty_is_valid() {
|
||||
@ -275,23 +275,25 @@ fn globals() {
|
||||
assert!(validate_module(&m).is_err());
|
||||
}
|
||||
|
||||
// TODO: pepyakin
|
||||
// #[test]
|
||||
// fn if_else_with_return_type_validation() {
|
||||
// let module_instance = ModuleInstance::new(Weak::default(), "test".into(), module().build()).unwrap();
|
||||
// let mut context = FunctionValidationContext::new(&module_instance, None, &[], 1024, 1024, FunctionSignature::Module(&FunctionType::default()));
|
||||
|
||||
// Validator::validate_function(&mut context, BlockType::NoResult, &[
|
||||
// Opcode::I32Const(1),
|
||||
// Opcode::If(BlockType::NoResult),
|
||||
// Opcode::I32Const(1),
|
||||
// Opcode::If(BlockType::Value(ValueType::I32)),
|
||||
// Opcode::I32Const(1),
|
||||
// Opcode::Else,
|
||||
// Opcode::I32Const(2),
|
||||
// Opcode::End,
|
||||
// Opcode::Drop,
|
||||
// Opcode::End,
|
||||
// Opcode::End,
|
||||
// ]).unwrap();
|
||||
// }
|
||||
#[test]
|
||||
fn if_else_with_return_type_validation() {
|
||||
let m = module()
|
||||
.function()
|
||||
.signature().build()
|
||||
.body().with_opcodes(Opcodes::new(vec![
|
||||
Opcode::I32Const(1),
|
||||
Opcode::If(BlockType::NoResult),
|
||||
Opcode::I32Const(1),
|
||||
Opcode::If(BlockType::Value(ValueType::I32)),
|
||||
Opcode::I32Const(1),
|
||||
Opcode::Else,
|
||||
Opcode::I32Const(2),
|
||||
Opcode::End,
|
||||
Opcode::Drop,
|
||||
Opcode::End,
|
||||
Opcode::End,
|
||||
])).build()
|
||||
.build()
|
||||
.build();
|
||||
validate_module(&m).unwrap();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user