summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2020-03-23 18:54:14 -0700
committerGitHub <noreply@github.com>2020-03-23 18:54:14 -0700
commit7898e57f28c89565b99e894e764e058346e28fbe (patch)
tree91d72a1bcef76ecb83f3f550710bee8f9152b8ce /test
parentdc396c9d57d59c33c99f5f6c6c1b8f67de086dc8 (diff)
downloadwabt-7898e57f28c89565b99e894e764e058346e28fbe.tar.gz
wabt-7898e57f28c89565b99e894e764e058346e28fbe.tar.bz2
wabt-7898e57f28c89565b99e894e764e058346e28fbe.zip
Parse ArrayTypes (#1364)
The following formats are supported: * (type (array i32)) * (type (array (field i32))) * (type (array (field (mut i32)))) This PR adds support for reading/writing binary and text, but no interpreter support yet.
Diffstat (limited to 'test')
-rw-r--r--test/dump/array.txt18
-rw-r--r--test/parse/module/array-mut-field.txt3
-rw-r--r--test/parse/module/array.txt3
-rw-r--r--test/parse/module/bad-array-no-fields.txt9
-rw-r--r--test/parse/module/bad-array-too-many-fields.txt9
5 files changed, 42 insertions, 0 deletions
diff --git a/test/dump/array.txt b/test/dump/array.txt
new file mode 100644
index 00000000..6dc380c2
--- /dev/null
+++ b/test/dump/array.txt
@@ -0,0 +1,18 @@
+;;; TOOL: run-objdump
+;;; ARGS0: --enable-gc
+;;; ARGS1: -x
+(type (array i32))
+(type (array (mut i64)))
+(;; STDOUT ;;;
+
+array.wasm: file format wasm 0x1
+
+Section Details:
+
+Type[2]:
+ - type[0] (array i32)
+ - type[1] (array (mut i64))
+
+Code Disassembly:
+
+;;; STDOUT ;;)
diff --git a/test/parse/module/array-mut-field.txt b/test/parse/module/array-mut-field.txt
new file mode 100644
index 00000000..1aead5a3
--- /dev/null
+++ b/test/parse/module/array-mut-field.txt
@@ -0,0 +1,3 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-gc
+(type (array (mut f32)))
diff --git a/test/parse/module/array.txt b/test/parse/module/array.txt
new file mode 100644
index 00000000..6426d5a4
--- /dev/null
+++ b/test/parse/module/array.txt
@@ -0,0 +1,3 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-gc
+(type (array i32))
diff --git a/test/parse/module/bad-array-no-fields.txt b/test/parse/module/bad-array-no-fields.txt
new file mode 100644
index 00000000..d01e4d31
--- /dev/null
+++ b/test/parse/module/bad-array-no-fields.txt
@@ -0,0 +1,9 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-gc
+;;; ERROR: 1
+(type (array))
+(;; STDERR ;;;
+out/test/parse/module/bad-array-no-fields.txt:4:13: error: unexpected token ")", expected i32, i64, f32, f64, v128 or anyref.
+(type (array))
+ ^
+;;; STDERR ;;)
diff --git a/test/parse/module/bad-array-too-many-fields.txt b/test/parse/module/bad-array-too-many-fields.txt
new file mode 100644
index 00000000..3324ea44
--- /dev/null
+++ b/test/parse/module/bad-array-too-many-fields.txt
@@ -0,0 +1,9 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-gc
+;;; ERROR: 1
+(type (array i32 i32))
+(;; STDERR ;;;
+out/test/parse/module/bad-array-too-many-fields.txt:4:18: error: unexpected token i32, expected ).
+(type (array i32 i32))
+ ^^^
+;;; STDERR ;;)