summaryrefslogtreecommitdiff
path: root/test/lit/wasm-emscripten-finalize/em_js.wat
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/wasm-emscripten-finalize/em_js.wat')
-rw-r--r--test/lit/wasm-emscripten-finalize/em_js.wat28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/lit/wasm-emscripten-finalize/em_js.wat b/test/lit/wasm-emscripten-finalize/em_js.wat
new file mode 100644
index 000000000..c2dd4c17d
--- /dev/null
+++ b/test/lit/wasm-emscripten-finalize/em_js.wat
@@ -0,0 +1,28 @@
+;; Test that funcions exported with __em_js are correctly removed
+;; once they strings they return are extracted.
+
+;; RUN: wasm-emscripten-finalize %s -S | filecheck %s
+
+;; Both functions should be stripped from the binary
+;; CHECK-NOT: (func
+
+;; CHECK: "emJsFuncs": {
+;; CHECK-NEXT: "bar": "more JS string dara",
+;; CHECK-NEXT: "foo": "some JS string"
+;; CHECK-NEXT: },
+
+(module
+ (memory 1 1)
+ (data (i32.const 1024) "some JS string\00")
+ (data (i32.const 2048) "more JS string dara\00")
+ (export "__em_js__foo" (func $__em_js__foo))
+ (export "__em_js__bar" (func $bar))
+ ;; Name matches export name
+ (func $__em_js__foo (result i32)
+ (i32.const 1024)
+ )
+ ;; Name does not match export name
+ (func $bar (result i32)
+ (i32.const 2048)
+ )
+)