summaryrefslogtreecommitdiff
path: root/test/lit/wasm-emscripten-finalize/em_js.wat
blob: c2dd4c17d9a826cf602505ac55157c02b7837239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
 )
)