From 056ac258cdb05e88351be730a73c4df4e1e472bc Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Tue, 5 Dec 2017 12:41:14 +0100 Subject: [PATCH] Test recursive calls --- src/validation/tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/validation/tests.rs b/src/validation/tests.rs index 5df2778..460d276 100644 --- a/src/validation/tests.rs +++ b/src/validation/tests.rs @@ -229,6 +229,28 @@ fn module_limits_validity() { assert!(validate_module(&m).is_err()); } +#[test] +fn funcs() { + // recursive function calls is legal. + let m = module() + .function() + .signature().return_type().i32().build() + .body().with_opcodes(Opcodes::new(vec![ + Opcode::Call(1), + Opcode::End, + ])).build() + .build() + .function() + .signature().return_type().i32().build() + .body().with_opcodes(Opcodes::new(vec![ + Opcode::Call(0), + Opcode::End, + ])).build() + .build() + .build(); + assert!(validate_module(&m).is_ok()); +} + // TODO: pepyakin // #[test] // fn if_else_with_return_type_validation() {