summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/spec/exports.wast
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/wasm/spec/exports.wast
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/wasm/spec/exports.wast')
-rw-r--r--js/src/jit-test/tests/wasm/spec/exports.wast196
1 files changed, 196 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/spec/exports.wast b/js/src/jit-test/tests/wasm/spec/exports.wast
new file mode 100644
index 000000000..e3a0052a6
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/exports.wast
@@ -0,0 +1,196 @@
+;; Functions
+
+(module (func) (export "a" (func 0)))
+(module (func) (export "a" (func 0)) (export "b" (func 0)))
+(module (func) (func) (export "a" (func 0)) (export "b" (func 1)))
+
+(module (func (export "a")))
+(module (func) (export "a" (func 0)))
+(module (func $a (export "a")))
+(module (func $a) (export "a" (func $a)))
+(module (export "a" (func 0)) (func))
+(module (export "a" (func $a)) (func $a))
+
+(module $Func
+ (export "e" (func $f))
+ (func $f (param $n i32) (result i32)
+ (return (i32.add (get_local $n) (i32.const 1)))
+ )
+)
+(assert_return (invoke "e" (i32.const 42)) (i32.const 43))
+(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43))
+(module)
+(module $Other1)
+(assert_return (invoke $Func "e" (i32.const 42)) (i32.const 43))
+
+(assert_invalid
+ (module (func) (export "a" (func 1)))
+ "unknown function"
+)
+(assert_invalid
+ (module (func) (export "a" (func 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (func) (export "a" (func 0)) (export "a" (func 1)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (global i32 (i32.const 0)) (export "a" (func 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (table 0 anyfunc) (export "a" (func 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (func) (memory 0) (export "a" (func 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+
+
+;; Globals
+
+(module (global i32 (i32.const 0)) (export "a" (global 0)))
+(module (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 0)))
+(module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "b" (global 1)))
+
+(module (global (export "a") i32 (i32.const 0)))
+(module (global i32 (i32.const 0)) (export "a" (global 0)))
+(module (global $a (export "a") i32 (i32.const 0)))
+(module (global $a i32 (i32.const 0)) (export "a" (global $a)))
+(module (export "a" (global 0)) (global i32 (i32.const 0)))
+(module (export "a" (global $a)) (global $a i32 (i32.const 0)))
+
+(module $Global
+ (export "e" (global $g))
+ (global $g i32 (i32.const 42))
+)
+(assert_return (get "e") (i32.const 42))
+(assert_return (get $Global "e") (i32.const 42))
+(module)
+(module $Other2)
+(assert_return (get $Global "e") (i32.const 42))
+
+(assert_invalid
+ (module (global i32 (i32.const 0)) (export "a" (global 1)))
+ "unknown global"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (global i32 (i32.const 0)) (export "a" (global 0)) (export "a" (global 1)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (func) (export "a" (global 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (table 0 anyfunc) (export "a" (global 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (global i32 (i32.const 0)) (memory 0) (export "a" (global 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+
+
+;; Tables
+
+(module (table 0 anyfunc) (export "a" (table 0)))
+(module (table 0 anyfunc) (export "a" (table 0)) (export "b" (table 0)))
+;; No multiple tables yet.
+;; (module (table 0 anyfunc) (table 0 anyfunc) (export "a" (table 0)) (export "b" (table 1)))
+
+(module (table (export "a") 0 anyfunc))
+(module (table (export "a") 0 1 anyfunc))
+(module (table 0 anyfunc) (export "a" (table 0)))
+(module (table 0 1 anyfunc) (export "a" (table 0)))
+(module (table $a (export "a") 0 anyfunc))
+(module (table $a (export "a") 0 1 anyfunc))
+(module (table $a 0 anyfunc) (export "a" (table $a)))
+(module (table $a 0 1 anyfunc) (export "a" (table $a)))
+(module (export "a" (table 0)) (table 0 anyfunc))
+(module (export "a" (table 0)) (table 0 1 anyfunc))
+(module (export "a" (table $a)) (table $a 0 anyfunc))
+(module (export "a" (table $a)) (table $a 0 1 anyfunc))
+
+(; TODO: access table ;)
+
+(assert_invalid
+ (module (table 0 anyfunc) (export "a" (table 1)))
+ "unknown table"
+)
+(assert_invalid
+ (module (table 0 anyfunc) (export "a" (table 0)) (export "a" (table 0)))
+ "duplicate export name"
+)
+;; No multiple tables yet.
+;; (assert_invalid
+;; (module (table 0 anyfunc) (table 0 anyfunc) (export "a" (table 0)) (export "a" (table 1)))
+;; "duplicate export name"
+;; )
+(assert_invalid
+ (module (table 0 anyfunc) (func) (export "a" (table 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (table 0 anyfunc) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (table 0 anyfunc) (memory 0) (export "a" (table 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+
+
+;; Memories
+
+(module (memory 0) (export "a" (memory 0)))
+(module (memory 0) (export "a" (memory 0)) (export "b" (memory 0)))
+;; No multiple memories yet.
+;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "b" (memory 1)))
+
+(module (memory (export "a") 0))
+(module (memory (export "a") 0 1))
+(module (memory 0) (export "a" (memory 0)))
+(module (memory 0 1) (export "a" (memory 0)))
+(module (memory $a (export "a") 0))
+(module (memory $a (export "a") 0 1))
+(module (memory $a 0) (export "a" (memory $a)))
+(module (memory $a 0 1) (export "a" (memory $a)))
+(module (export "a" (memory 0)) (memory 0))
+(module (export "a" (memory 0)) (memory 0 1))
+(module (export "a" (memory $a)) (memory $a 0))
+(module (export "a" (memory $a)) (memory $a 0 1))
+
+(; TODO: access memory ;)
+
+(assert_invalid
+ (module (memory 0) (export "a" (memory 1)))
+ "unknown memory"
+)
+(assert_invalid
+ (module (memory 0) (export "a" (memory 0)) (export "a" (memory 0)))
+ "duplicate export name"
+)
+;; No multiple memories yet.
+;; (assert_invalid
+;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "a" (memory 1)))
+;; "duplicate export name"
+;; )
+(assert_invalid
+ (module (memory 0) (func) (export "a" (memory 0)) (export "a" (func 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (memory 0) (global i32 (i32.const 0)) (export "a" (memory 0)) (export "a" (global 0)))
+ "duplicate export name"
+)
+(assert_invalid
+ (module (memory 0) (table 0 anyfunc) (export "a" (memory 0)) (export "a" (table 0)))
+ "duplicate export name"
+)