diff options
Diffstat (limited to 'test/parse/func')
34 files changed, 154 insertions, 0 deletions
diff --git a/test/parse/func/bad-func-name.txt b/test/parse/func/bad-func-name.txt new file mode 100644 index 00000000..94e66244 --- /dev/null +++ b/test/parse/func/bad-func-name.txt @@ -0,0 +1,6 @@ +;;; ERROR: 1 +(module + (func foo)) +(;; STDERR ;;; +parse/func/bad-func-name.txt:3:9: unexpected token "foo" +;;; STDERR ;;) diff --git a/test/parse/func/bad-local-binding-no-type.txt b/test/parse/func/bad-local-binding-no-type.txt new file mode 100644 index 00000000..84e92047 --- /dev/null +++ b/test/parse/func/bad-local-binding-no-type.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (local $n))) +(;; STDERR ;;; +parse/func/bad-local-binding-no-type.txt:2:24: syntax error, unexpected ), expecting VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-local-binding.txt b/test/parse/func/bad-local-binding.txt new file mode 100644 index 00000000..d2617ef6 --- /dev/null +++ b/test/parse/func/bad-local-binding.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (local $foo $bar))) +(;; STDERR ;;; +parse/func/bad-local-binding.txt:2:27: syntax error, unexpected VAR, expecting VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-local-name.txt b/test/parse/func/bad-local-name.txt new file mode 100644 index 00000000..470e28f0 --- /dev/null +++ b/test/parse/func/bad-local-name.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (local 0 i32))) +(;; STDERR ;;; +parse/func/bad-local-name.txt:2:22: syntax error, unexpected INT, expecting ) or VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-local-type-list.txt b/test/parse/func/bad-local-type-list.txt new file mode 100644 index 00000000..bb597741 --- /dev/null +++ b/test/parse/func/bad-local-type-list.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (local i32 i64 foo f32))) +(;; STDERR ;;; +parse/func/bad-local-type-list.txt:2:30: unexpected token "foo" +;;; STDERR ;;) diff --git a/test/parse/func/bad-local-type.txt b/test/parse/func/bad-local-type.txt new file mode 100644 index 00000000..4f901b78 --- /dev/null +++ b/test/parse/func/bad-local-type.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (local foo))) +(;; STDERR ;;; +parse/func/bad-local-type.txt:2:22: unexpected token "foo" +;;; STDERR ;;) diff --git a/test/parse/func/bad-param-after-local.txt b/test/parse/func/bad-param-after-local.txt new file mode 100644 index 00000000..b7b71754 --- /dev/null +++ b/test/parse/func/bad-param-after-local.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (local i32) (param i32))) +(;; STDERR ;;; +parse/func/bad-param-after-local.txt:2:28: syntax error, unexpected PARAM +;;; STDERR ;;) diff --git a/test/parse/func/bad-param-binding.txt b/test/parse/func/bad-param-binding.txt new file mode 100644 index 00000000..aeeca691 --- /dev/null +++ b/test/parse/func/bad-param-binding.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (param $bar $baz))) +(;; STDERR ;;; +parse/func/bad-param-binding.txt:2:27: syntax error, unexpected VAR, expecting VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-param-name.txt b/test/parse/func/bad-param-name.txt new file mode 100644 index 00000000..ddd4e273 --- /dev/null +++ b/test/parse/func/bad-param-name.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (param 0 i32))) +(;; STDERR ;;; +parse/func/bad-param-name.txt:2:22: syntax error, unexpected INT, expecting ) or VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-param-redefinition.txt b/test/parse/func/bad-param-redefinition.txt new file mode 100644 index 00000000..4a57f312 --- /dev/null +++ b/test/parse/func/bad-param-redefinition.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (param $n i32) (param $n f32))) +(;; STDERR ;;; +parse/func/bad-param-redefinition.txt:2:31: redefinition of parameter "$n" +;;; STDERR ;;) diff --git a/test/parse/func/bad-param-type-list.txt b/test/parse/func/bad-param-type-list.txt new file mode 100644 index 00000000..f2c6d625 --- /dev/null +++ b/test/parse/func/bad-param-type-list.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (param i32 i64 foo f32))) +(;; STDERR ;;; +parse/func/bad-param-type-list.txt:2:30: unexpected token "foo" +;;; STDERR ;;) diff --git a/test/parse/func/bad-param.txt b/test/parse/func/bad-param.txt new file mode 100644 index 00000000..2f6b6928 --- /dev/null +++ b/test/parse/func/bad-param.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (param foo))) +(;; STDERR ;;; +parse/func/bad-param.txt:2:22: unexpected token "foo" +;;; STDERR ;;) diff --git a/test/parse/func/bad-result-empty.txt b/test/parse/func/bad-result-empty.txt new file mode 100644 index 00000000..793cda5b --- /dev/null +++ b/test/parse/func/bad-result-empty.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (result))) +(;; STDERR ;;; +parse/func/bad-result-empty.txt:2:22: syntax error, unexpected ), expecting VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-result-multi.txt b/test/parse/func/bad-result-multi.txt new file mode 100644 index 00000000..f44a7914 --- /dev/null +++ b/test/parse/func/bad-result-multi.txt @@ -0,0 +1,5 @@ +;;; ERROR: 1 +(module (func (result i32 i64))) +(;; STDERR ;;; +parse/func/bad-result-multi.txt:2:27: syntax error, unexpected VALUE_TYPE, expecting ) +;;; STDERR ;;) diff --git a/test/parse/func/bad-result-type.txt b/test/parse/func/bad-result-type.txt new file mode 100644 index 00000000..271e0509 --- /dev/null +++ b/test/parse/func/bad-result-type.txt @@ -0,0 +1,6 @@ +;;; ERROR: 1 +(module (func (result foo))) +(;; STDERR ;;; +parse/func/bad-result-type.txt:2:23: unexpected token "foo" +parse/func/bad-result-type.txt:2:26: syntax error, unexpected ), expecting VALUE_TYPE +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-param-type-mismatch.txt b/test/parse/func/bad-sig-param-type-mismatch.txt new file mode 100644 index 00000000..80dc7b42 --- /dev/null +++ b/test/parse/func/bad-sig-param-type-mismatch.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func (param i32 f32))) + (func (type $t) (param f32 f32))) +(;; STDERR ;;; +parse/func/bad-sig-param-type-mismatch.txt:4:4: type mismatch for argument 0 of function. got f32, expected i32 +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-params-empty.txt b/test/parse/func/bad-sig-params-empty.txt new file mode 100644 index 00000000..c15bcf74 --- /dev/null +++ b/test/parse/func/bad-sig-params-empty.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func)) + (func (type $t) (param i32))) +(;; STDERR ;;; +parse/func/bad-sig-params-empty.txt:4:4: expected 0 parameters, got 1 +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-result-type-mistmatch.txt b/test/parse/func/bad-sig-result-type-mistmatch.txt new file mode 100644 index 00000000..8f76d62e --- /dev/null +++ b/test/parse/func/bad-sig-result-type-mistmatch.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func (param i32) (result f32))) + (func (type $t) (param i32) (result i64))) +(;; STDERR ;;; +parse/func/bad-sig-result-type-mistmatch.txt:4:4: type mismatch. got i64, expected f32 +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-result-type-not-void.txt b/test/parse/func/bad-sig-result-type-not-void.txt new file mode 100644 index 00000000..505fb621 --- /dev/null +++ b/test/parse/func/bad-sig-result-type-not-void.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func (param i32))) + (func (type $t) (param i32) (result f32))) +(;; STDERR ;;; +parse/func/bad-sig-result-type-not-void.txt:4:4: type mismatch. got f32, expected void +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-result-type-void.txt b/test/parse/func/bad-sig-result-type-void.txt new file mode 100644 index 00000000..a99c0d8e --- /dev/null +++ b/test/parse/func/bad-sig-result-type-void.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func (param i32) (result f32))) + (func (type $t) (param i32))) +(;; STDERR ;;; +parse/func/bad-sig-result-type-void.txt:4:4: type mismatch. got void, expected f32 +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-too-few-params.txt b/test/parse/func/bad-sig-too-few-params.txt new file mode 100644 index 00000000..f588ab95 --- /dev/null +++ b/test/parse/func/bad-sig-too-few-params.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func (param i32 f32))) + (func (type $t) (param i32))) +(;; STDERR ;;; +parse/func/bad-sig-too-few-params.txt:4:4: expected 2 parameters, got 1 +;;; STDERR ;;) diff --git a/test/parse/func/bad-sig-too-many-params.txt b/test/parse/func/bad-sig-too-many-params.txt new file mode 100644 index 00000000..027f91d7 --- /dev/null +++ b/test/parse/func/bad-sig-too-many-params.txt @@ -0,0 +1,7 @@ +;;; ERROR: 1 +(module + (type $t (func (param i32))) + (func (type $t) (param i32 i32))) +(;; STDERR ;;; +parse/func/bad-sig-too-many-params.txt:4:4: expected 1 parameters, got 2 +;;; STDERR ;;) diff --git a/test/parse/func/func-named.txt b/test/parse/func/func-named.txt new file mode 100644 index 00000000..f744db34 --- /dev/null +++ b/test/parse/func/func-named.txt @@ -0,0 +1 @@ +(module (func $foo)) diff --git a/test/parse/func/local-empty.txt b/test/parse/func/local-empty.txt new file mode 100644 index 00000000..0c9c3d8f --- /dev/null +++ b/test/parse/func/local-empty.txt @@ -0,0 +1 @@ +(module (func (local))) diff --git a/test/parse/func/local-multi.txt b/test/parse/func/local-multi.txt new file mode 100644 index 00000000..bb5813d2 --- /dev/null +++ b/test/parse/func/local-multi.txt @@ -0,0 +1 @@ +(module (func (local i32) (local $n i64))) diff --git a/test/parse/func/local.txt b/test/parse/func/local.txt new file mode 100644 index 00000000..c5b0149f --- /dev/null +++ b/test/parse/func/local.txt @@ -0,0 +1 @@ +(module (func (local i32))) diff --git a/test/parse/func/no-space.txt b/test/parse/func/no-space.txt new file mode 100644 index 00000000..db3827e3 --- /dev/null +++ b/test/parse/func/no-space.txt @@ -0,0 +1,4 @@ +(module + (func $foomore(call $foo (i32.const 0x0))) + (func $foo (param i32)(nop)) +) diff --git a/test/parse/func/param-binding.txt b/test/parse/func/param-binding.txt new file mode 100644 index 00000000..0d79fef5 --- /dev/null +++ b/test/parse/func/param-binding.txt @@ -0,0 +1 @@ +(module (func (param $foo i32))) diff --git a/test/parse/func/param-multi.txt b/test/parse/func/param-multi.txt new file mode 100644 index 00000000..9ab0a662 --- /dev/null +++ b/test/parse/func/param-multi.txt @@ -0,0 +1 @@ +(module (func (param i32) (param $n f64))) diff --git a/test/parse/func/param-type-1.txt b/test/parse/func/param-type-1.txt new file mode 100644 index 00000000..a1aa01b5 --- /dev/null +++ b/test/parse/func/param-type-1.txt @@ -0,0 +1 @@ +(module (func (param i32))) diff --git a/test/parse/func/param-type-2.txt b/test/parse/func/param-type-2.txt new file mode 100644 index 00000000..19e0dc3a --- /dev/null +++ b/test/parse/func/param-type-2.txt @@ -0,0 +1 @@ +(module (func (param i32 f32))) diff --git a/test/parse/func/result.txt b/test/parse/func/result.txt new file mode 100644 index 00000000..aa622c78 --- /dev/null +++ b/test/parse/func/result.txt @@ -0,0 +1 @@ +(module (func (result i32) (i32.const 0))) diff --git a/test/parse/func/sig-match.txt b/test/parse/func/sig-match.txt new file mode 100644 index 00000000..0042a9f5 --- /dev/null +++ b/test/parse/func/sig-match.txt @@ -0,0 +1,12 @@ +(module + (type $empty (func)) + (type $i_v (func (param i32))) + (type $f_i (func (param f32) (result i32))) + (type $ii_i (func (param i32 i32) (result i32))) + (type $v_f (func (result f32))) + + (func (type $empty)) + (func (type $i_v) (param i32)) + (func (type $f_i) (param f32) (result i32) (i32.const 0)) + (func (type $ii_i) (param i32 i32) (result i32) (i32.const 0)) + (func (type $v_f) (result f32) (f32.const 0))) diff --git a/test/parse/func/sig.txt b/test/parse/func/sig.txt new file mode 100644 index 00000000..649c66c5 --- /dev/null +++ b/test/parse/func/sig.txt @@ -0,0 +1,3 @@ +(module + (type $t (func (param i32) (result i32))) + (func (type $t) (i32.const 0))) |