summaryrefslogtreecommitdiff
path: root/test/parse
diff options
context:
space:
mode:
Diffstat (limited to 'test/parse')
-rw-r--r--test/parse/expr/reference-types-call-indirect.txt18
-rw-r--r--test/parse/expr/reference-types-named.txt21
-rw-r--r--test/parse/expr/reference-types.txt55
-rw-r--r--test/parse/expr/table-get.txt8
-rw-r--r--test/parse/expr/table-grow.txt9
-rw-r--r--test/parse/expr/table-set.txt9
-rw-r--r--test/parse/func/bad-local-binding-no-type.txt2
-rw-r--r--test/parse/func/bad-local-binding.txt2
-rw-r--r--test/parse/func/bad-param-binding.txt2
-rw-r--r--test/parse/module/reference-types-disabled.txt20
10 files changed, 143 insertions, 3 deletions
diff --git a/test/parse/expr/reference-types-call-indirect.txt b/test/parse/expr/reference-types-call-indirect.txt
new file mode 100644
index 00000000..bcb74296
--- /dev/null
+++ b/test/parse/expr/reference-types-call-indirect.txt
@@ -0,0 +1,18 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-reference-types
+
+(module
+ (table $foo 1 anyfunc)
+ (table $bar 1 anyfunc)
+
+ (func (result i32) i32.const 0)
+ (func (result i32) i32.const 1)
+
+ (func (result i32)
+ i32.const 0
+ call_indirect (type 0) $foo)
+
+ (func (result i32)
+ i32.const 0
+ call_indirect (type 0) $bar)
+)
diff --git a/test/parse/expr/reference-types-named.txt b/test/parse/expr/reference-types-named.txt
new file mode 100644
index 00000000..e9d1a63d
--- /dev/null
+++ b/test/parse/expr/reference-types-named.txt
@@ -0,0 +1,21 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-reference-types
+
+(module
+ (table $foo 1 anyref)
+ (func (result anyref)
+ i32.const 0
+ table.get $foo
+ )
+ (func (param anyref)
+ i32.const 0
+ get_local 0
+ table.set $foo
+ )
+ (func (result i32)
+ i32.const 0
+ ref.null
+ table.grow $foo
+ )
+)
+
diff --git a/test/parse/expr/reference-types.txt b/test/parse/expr/reference-types.txt
new file mode 100644
index 00000000..d46aaba3
--- /dev/null
+++ b/test/parse/expr/reference-types.txt
@@ -0,0 +1,55 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-reference-types
+
+(module
+ (table $foo 1 anyref)
+ (table $bar 1 anyref)
+ (table $baz 1 anyfunc)
+
+ (func (result anyref)
+ i32.const 0
+ table.get $foo
+ )
+ (func (result anyref)
+ i32.const 0
+ table.get $bar
+ )
+
+ (func (param anyref)
+ i32.const 0
+ get_local 0
+ table.set $foo
+ )
+ (func (param anyref)
+ i32.const 0
+ get_local 0
+ table.set $bar
+ )
+
+ (func (result i32)
+ i32.const 0
+ ref.null
+ table.grow $foo
+ )
+ (func (result i32)
+ i32.const 0
+ ref.null
+ table.grow $bar
+ )
+
+ (func (param anyref) (result i32)
+ local.get 0
+ ref.is_null
+ )
+
+
+ (func (result i32)
+ table.size $foo
+ )
+ (func (result i32)
+ table.size $bar
+ )
+ (func (result i32)
+ table.size $baz
+ )
+)
diff --git a/test/parse/expr/table-get.txt b/test/parse/expr/table-get.txt
new file mode 100644
index 00000000..ed2e7155
--- /dev/null
+++ b/test/parse/expr/table-get.txt
@@ -0,0 +1,8 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-reference-types
+(module
+ (func (result anyref)
+ i32.const 0
+ table.get 0)
+
+ (table 1 anyref))
diff --git a/test/parse/expr/table-grow.txt b/test/parse/expr/table-grow.txt
new file mode 100644
index 00000000..8b8fcc59
--- /dev/null
+++ b/test/parse/expr/table-grow.txt
@@ -0,0 +1,9 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-reference-types
+(module
+ (func (result i32)
+ i32.const 0
+ ref.null
+ table.grow 0)
+
+ (table 1 anyref))
diff --git a/test/parse/expr/table-set.txt b/test/parse/expr/table-set.txt
new file mode 100644
index 00000000..d441437e
--- /dev/null
+++ b/test/parse/expr/table-set.txt
@@ -0,0 +1,9 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-reference-types
+(module
+ (func (param anyref)
+ i32.const 0
+ get_local 0
+ table.set 0)
+
+ (table 1 anyref))
diff --git a/test/parse/func/bad-local-binding-no-type.txt b/test/parse/func/bad-local-binding-no-type.txt
index 9c1a3a88..029218e9 100644
--- a/test/parse/func/bad-local-binding-no-type.txt
+++ b/test/parse/func/bad-local-binding-no-type.txt
@@ -2,7 +2,7 @@
;;; ERROR: 1
(module (func (local $n)))
(;; STDERR ;;;
-out/test/parse/func/bad-local-binding-no-type.txt:3:24: error: unexpected token ")", expected i32, i64, f32, f64 or v128.
+out/test/parse/func/bad-local-binding-no-type.txt:3:24: error: unexpected token ")", expected i32, i64, f32, f64, v128 or anyref.
(module (func (local $n)))
^
;;; STDERR ;;)
diff --git a/test/parse/func/bad-local-binding.txt b/test/parse/func/bad-local-binding.txt
index 4aee0258..51110dfe 100644
--- a/test/parse/func/bad-local-binding.txt
+++ b/test/parse/func/bad-local-binding.txt
@@ -2,7 +2,7 @@
;;; ERROR: 1
(module (func (local $foo $bar)))
(;; STDERR ;;;
-out/test/parse/func/bad-local-binding.txt:3:27: error: unexpected token "$bar", expected i32, i64, f32, f64 or v128.
+out/test/parse/func/bad-local-binding.txt:3:27: error: unexpected token "$bar", expected i32, i64, f32, f64, v128 or anyref.
(module (func (local $foo $bar)))
^^^^
;;; STDERR ;;)
diff --git a/test/parse/func/bad-param-binding.txt b/test/parse/func/bad-param-binding.txt
index 323ad4b2..f813b23c 100644
--- a/test/parse/func/bad-param-binding.txt
+++ b/test/parse/func/bad-param-binding.txt
@@ -2,7 +2,7 @@
;;; ERROR: 1
(module (func (param $bar $baz)))
(;; STDERR ;;;
-out/test/parse/func/bad-param-binding.txt:3:27: error: unexpected token "$baz", expected i32, i64, f32, f64 or v128.
+out/test/parse/func/bad-param-binding.txt:3:27: error: unexpected token "$baz", expected i32, i64, f32, f64, v128 or anyref.
(module (func (param $bar $baz)))
^^^^
;;; STDERR ;;)
diff --git a/test/parse/module/reference-types-disabled.txt b/test/parse/module/reference-types-disabled.txt
new file mode 100644
index 00000000..10963352
--- /dev/null
+++ b/test/parse/module/reference-types-disabled.txt
@@ -0,0 +1,20 @@
+;;; TOOL: wat2wasm
+;;; ERROR: 1
+
+(module
+ (table $t 1 anyref)
+ (func
+ i32.const 0
+ i32.const 0
+ table.get $t
+ table.set $t
+ )
+)
+(;; STDERR ;;;
+out/test/parse/module/reference-types-disabled.txt:9:5: error: opcode not allowed: table.get
+ table.get $t
+ ^^^^^^^^^
+out/test/parse/module/reference-types-disabled.txt:10:5: error: opcode not allowed: table.set
+ table.set $t
+ ^^^^^^^^^
+;;; STDERR ;;)