Skip to content

Commit

Permalink
Merge pull request #8 from dhil/wasmfx-main
Browse files Browse the repository at this point in the history
Merge with WebAssembly/spec
  • Loading branch information
dhil authored Sep 21, 2023
2 parents 7fb5764 + aa62cdd commit ab3bf77
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 1 deletion.
2 changes: 1 addition & 1 deletion interpreter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test/%: $(NAME)
run/%: $(NAME)
./$(NAME) $(TESTDIR)/$*.wast

partest: $(NAME)
partest: $(NAME) unittest
make -j10 quiettest

quiettest: $(TESTS:%=quiettest/%)
Expand Down
14 changes: 14 additions & 0 deletions test/core/if.wast
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,14 @@
)
(drop) (drop) (drop)
)

;; Atypical folded condition syntax

(func (export "atypical-condition")
i32.const 0
(if (then) (else))
(if (i32.const 1) (i32.eqz) (then) (else))
)
)

(assert_return (invoke "empty" (i32.const 0)))
Expand Down Expand Up @@ -722,6 +730,8 @@

(assert_return (invoke "type-use"))

(assert_return (invoke "atypical-condition"))

(assert_malformed
(module quote
"(type $sig (func (param i32) (result i32)))"
Expand Down Expand Up @@ -1548,3 +1558,7 @@
(module quote "(func i32.const 0 if $a else $l end $l)")
"mismatching label"
)
(assert_malformed
(module quote "(func (if i32.const 0 (then) (else)))")
"unexpected token"
)
82 changes: 82 additions & 0 deletions test/core/obsolete-keywords.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
;; Renamed in https://github.com/WebAssembly/spec/pull/720
(assert_malformed
(module quote
"(memory 1)"
"(func (drop (current_memory)))"
)
"unknown operator current_memory"
)

(assert_malformed
(module quote
"(memory 1)"
"(func (drop (grow_memory (i32.const 0))))"
)
"unknown operator grow_memory"
)

;; Renamed in https://github.com/WebAssembly/spec/pull/926
(assert_malformed
(module quote
"(func (local $i i32) (drop (get_local $i)))"
)
"unknown operator get_local"
)

(assert_malformed
(module quote
"(func (local $i i32) (set_local $i (i32.const 0)))"
)
"unknown operator set_local"
)

(assert_malformed
(module quote
"(func (local $i i32) (drop (tee_local $i (i32.const 0))))"
)
"unknown operator tee_local"
)

(assert_malformed
(module quote
"(global $g anyfunc (ref.null func))"
)
"unknown operator anyfunc"
)

(assert_malformed
(module quote
"(global $g i32 (i32.const 0))"
"(func (drop (get_global $g)))"
)
"unknown operator get_global"
)

(assert_malformed
(module quote
"(global $g (mut i32) (i32.const 0))"
"(func (set_global $g (i32.const 0)))"
)
"unknown operator set_global"
)

(assert_malformed
(module quote
"(func (drop (i32.wrap/i64 (i64.const 0))))"
)
"unknown operator i32.wrap/i64"
)

(assert_malformed
(module quote
"(func (drop (i32.trunc_s:sat/f32 (f32.const 0))))"
)
"unknown operator i32.trunc_s:sat/f32"
)

(assert_malformed
(module quote
"(func (drop (f32x4.convert_s/i32x4 (v128.const i64x2 0 0))))"
)
"unknown operator f32x4.convert_s/i32x4"
)

0 comments on commit ab3bf77

Please sign in to comment.