Skip to content

Commit

Permalink
Add tests for using nan patterns outside of script (#1373)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngzhian authored Oct 13, 2021
1 parent 530d309 commit 5893af5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/core/f32.wast
Original file line number Diff line number Diff line change
Expand Up @@ -2531,3 +2531,13 @@
(assert_invalid (module (func (result f32) (f32.nearest (i64.const 0)))) "type mismatch")
(assert_invalid (module (func (result f32) (f32.sqrt (i64.const 0)))) "type mismatch")
(assert_invalid (module (func (result f32) (f32.trunc (i64.const 0)))) "type mismatch")

;; These float literal patterns are only allowed in scripts, not in text format.
(assert_malformed
(module quote "(func (result f32) (f32.const nan:arithmetic))")
"unexpected token"
)
(assert_malformed
(module quote "(func (result f32) (f32.const nan:canonical))")
"unexpected token"
)
10 changes: 10 additions & 0 deletions test/core/f64.wast
Original file line number Diff line number Diff line change
Expand Up @@ -2531,3 +2531,13 @@
(assert_invalid (module (func (result f64) (f64.nearest (i64.const 0)))) "type mismatch")
(assert_invalid (module (func (result f64) (f64.sqrt (i64.const 0)))) "type mismatch")
(assert_invalid (module (func (result f64) (f64.trunc (i64.const 0)))) "type mismatch")

;; These float literal patterns are only allowed in scripts, not in text format.
(assert_malformed
(module quote "(func (result f64) (f64.const nan:arithmetic))")
"unexpected token"
)
(assert_malformed
(module quote "(func (result f64) (f64.const nan:canonical))")
"unexpected token"
)

0 comments on commit 5893af5

Please sign in to comment.