Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/core/br_table.wast
Original file line number Diff line number Diff line change
Expand Up @@ -1463,3 +1463,12 @@
))
"unknown label"
)

(assert_malformed
(module quote "(func i32.const 0 br_table)")
"unexpected token"
)
(assert_malformed
(module quote "(func (br_table (i32.const 0)))")
"unexpected token"
)
5 changes: 5 additions & 0 deletions test/core/data.wast
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
(data $d14 "a" "" "bcd")
)

(assert_malformed
(module quote "(memory 1) (data $d \"\") (data $d \"\")")
"duplicate data segment"
)

;; Basic use

(module
Expand Down
21 changes: 21 additions & 0 deletions test/core/elem.wast
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,27 @@
(elem (i32.const 3) $g)
)

(assert_malformed
(module quote "(elem)")
"unexpected token"
)
(assert_malformed
(module quote "(elem $e)")
"unexpected token"
)
(assert_malformed
(module quote "(elem $e declare)")
"unexpected token"
)
(assert_malformed
(module quote "(table 1 funcref) (elem (table 0) (offset (i32.const 0)))")
"unexpected token"
)
(assert_malformed
(module quote "(elem $e func) (elem $e func)")
"duplicate elem segment"
)


;; Basic use

Expand Down
5 changes: 5 additions & 0 deletions test/core/exports.wast
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
"duplicate export name"
)

(assert_malformed
(module quote "(func) (export \"a\" (func 0 0))")
"unexpected token"
)


;; Globals

Expand Down
50 changes: 50 additions & 0 deletions test/core/func.wast
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,23 @@
"inline function type"
)

(assert_malformed
(module quote "(type $t (func)) (func (type $t) (type $t))")
"unexpected token"
)
(assert_malformed
(module quote "(type $t (func)) (type $u (func)) (func (type $t $u))")
"unexpected token"
)
(assert_malformed
(module quote "(type $t (func)) (func (type $t (foo)))")
"unexpected token"
)
(assert_malformed
(module quote "(type $t (func)) (func (type))")
"unexpected token"
)

(assert_invalid
(module (func $g (type 4)))
"unknown type"
Expand Down Expand Up @@ -959,6 +976,39 @@
"unexpected token"
)

(assert_malformed
(module quote "(func (local $x))")
"unexpected token"
)
(assert_malformed
(module quote "(func (local $x $y i32))")
"unexpected token"
)
(assert_malformed
(module quote "(func end)")
"unexpected token"
)
(assert_malformed
(module quote "(func (result i32) i32.const 1 end unreachable)")
"unexpected token"
)
(assert_malformed
(module quote "(func (end))")
"unexpected token"
)
(assert_malformed
(module quote "(func (end (nop)))")
"unexpected token"
)
(assert_malformed
(module quote "(func (block end) unreachable)")
"unexpected token"
)
(assert_malformed
(module quote "(func (block (end)))")
"unexpected token"
)

;; Duplicate name errors

(assert_malformed
Expand Down
17 changes: 17 additions & 0 deletions test/core/if.wast
Original file line number Diff line number Diff line change
Expand Up @@ -1562,3 +1562,20 @@
(module quote "(func (if i32.const 0 (then) (else)))")
"unexpected token"
)

(assert_malformed
(module quote "(func i32.const 1 if else else end)")
"unexpected token"
)
(assert_malformed
(module quote "(func (if (i32.const 1) (then) (else) (else)))")
"unexpected token"
)
(assert_malformed
(module quote "(func else)")
"unexpected token"
)
(assert_malformed
(module quote "(func block else end)")
"unexpected token"
)
21 changes: 21 additions & 0 deletions test/core/simd/meta/simd_store_lane.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ def get_invalid_cases(self):

invalid_cases.append('')

invalid_cases.append(';; the lane index comes after the memarg: $mem offset=1 0')
invalid_cases.append(
'(assert_malformed\n'
' (module quote\n'
' "(memory $mem 1)"\n'
' "(func (param $x v128)"\n'
' " (v128.store{lane_len}_lane $mem 0 offset=1 (i32.const 0) (local.get $x)))"\n'
' )\n'
' "unexpected token")'.format(lane_len=self.LANE_LEN))
invalid_cases.append(';; the lane index comes after the memarg: offset=1 0')
invalid_cases.append(
'(assert_malformed\n'
' (module quote\n'
' "(memory 1)"\n'
' "(func (param $x v128)"\n'
' " (v128.store{lane_len}_lane 0 offset=1 (i32.const 0) (local.get $x)))"\n'
' )\n'
' "unexpected token")'.format(lane_len=self.LANE_LEN))

invalid_cases.append('')

invalid_cases.append(';; invalid memarg alignment')
invalid_cases.append(
'(assert_invalid\n'
Expand Down
17 changes: 17 additions & 0 deletions test/core/simd/simd_store16_lane.wast
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,23 @@
(v128.store16_lane 8 (i32.const 0) (local.get $x))))
"invalid lane index")

;; the lane index comes after the memarg: $mem offset=1 0
(assert_malformed
(module quote
"(memory $mem 1)"
"(func (param $x v128)"
" (v128.store16_lane $mem 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")
;; the lane index comes after the memarg: offset=1 0
(assert_malformed
(module quote
"(memory 1)"
"(func (param $x v128)"
" (v128.store16_lane 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")

;; invalid memarg alignment
(assert_invalid
(module (memory 1)
Expand Down
17 changes: 17 additions & 0 deletions test/core/simd/simd_store32_lane.wast
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,23 @@
(v128.store32_lane 4 (i32.const 0) (local.get $x))))
"invalid lane index")

;; the lane index comes after the memarg: $mem offset=1 0
(assert_malformed
(module quote
"(memory $mem 1)"
"(func (param $x v128)"
" (v128.store32_lane $mem 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")
;; the lane index comes after the memarg: offset=1 0
(assert_malformed
(module quote
"(memory 1)"
"(func (param $x v128)"
" (v128.store32_lane 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")

;; invalid memarg alignment
(assert_invalid
(module (memory 1)
Expand Down
17 changes: 17 additions & 0 deletions test/core/simd/simd_store64_lane.wast
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,23 @@
(v128.store64_lane 2 (i32.const 0) (local.get $x))))
"invalid lane index")

;; the lane index comes after the memarg: $mem offset=1 0
(assert_malformed
(module quote
"(memory $mem 1)"
"(func (param $x v128)"
" (v128.store64_lane $mem 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")
;; the lane index comes after the memarg: offset=1 0
(assert_malformed
(module quote
"(memory 1)"
"(func (param $x v128)"
" (v128.store64_lane 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")

;; invalid memarg alignment
(assert_invalid
(module (memory 1)
Expand Down
17 changes: 17 additions & 0 deletions test/core/simd/simd_store8_lane.wast
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,23 @@
(v128.store8_lane 16 (i32.const 0) (local.get $x))))
"invalid lane index")

;; the lane index comes after the memarg: $mem offset=1 0
(assert_malformed
(module quote
"(memory $mem 1)"
"(func (param $x v128)"
" (v128.store8_lane $mem 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")
;; the lane index comes after the memarg: offset=1 0
(assert_malformed
(module quote
"(memory 1)"
"(func (param $x v128)"
" (v128.store8_lane 0 offset=1 (i32.const 0) (local.get $x)))"
)
"unexpected token")

;; invalid memarg alignment
(assert_invalid
(module (memory 1)
Expand Down
Loading