From 3403088734a84843e6a830b2246c4446bd7e21be Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 27 Feb 2021 21:55:03 +0000 Subject: [PATCH] [test] Test cases with imports the same name as exports --- test/core/imports.wast | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/core/imports.wast b/test/core/imports.wast index 187e0afb9d..6cfca2fc62 100644 --- a/test/core/imports.wast +++ b/test/core/imports.wast @@ -96,6 +96,26 @@ "unknown type" ) +;; Export sharing name with import +(module + (import "spectest" "print_i32" (func $imported_print (param i32))) + (func (export "print_i32") (param $i i32) + (call $imported_print (local.get $i)) + ) +) + +(assert_return (invoke "print_i32" (i32.const 13))) + +;; Export sharing name with import +(module + (import "spectest" "print_i32" (func $imported_print (param i32))) + (func (export "print_i32") (param $i i32) (param $j i32) (result i32) + (i32.add (local.get $i) (local.get $j)) + ) +) + +(assert_return (invoke "print_i32" (i32.const 5) (i32.const 11)) (i32.const 16)) + (module (import "test" "func" (func))) (module (import "test" "func-i32" (func (param i32)))) (module (import "test" "func-f32" (func (param f32))))