Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 5893af5

Browse files
authored
Add tests for using nan patterns outside of script (#1373)
1 parent 530d309 commit 5893af5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

test/core/f32.wast

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,3 +2531,13 @@
25312531
(assert_invalid (module (func (result f32) (f32.nearest (i64.const 0)))) "type mismatch")
25322532
(assert_invalid (module (func (result f32) (f32.sqrt (i64.const 0)))) "type mismatch")
25332533
(assert_invalid (module (func (result f32) (f32.trunc (i64.const 0)))) "type mismatch")
2534+
2535+
;; These float literal patterns are only allowed in scripts, not in text format.
2536+
(assert_malformed
2537+
(module quote "(func (result f32) (f32.const nan:arithmetic))")
2538+
"unexpected token"
2539+
)
2540+
(assert_malformed
2541+
(module quote "(func (result f32) (f32.const nan:canonical))")
2542+
"unexpected token"
2543+
)

test/core/f64.wast

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,3 +2531,13 @@
25312531
(assert_invalid (module (func (result f64) (f64.nearest (i64.const 0)))) "type mismatch")
25322532
(assert_invalid (module (func (result f64) (f64.sqrt (i64.const 0)))) "type mismatch")
25332533
(assert_invalid (module (func (result f64) (f64.trunc (i64.const 0)))) "type mismatch")
2534+
2535+
;; These float literal patterns are only allowed in scripts, not in text format.
2536+
(assert_malformed
2537+
(module quote "(func (result f64) (f64.const nan:arithmetic))")
2538+
"unexpected token"
2539+
)
2540+
(assert_malformed
2541+
(module quote "(func (result f64) (f64.const nan:canonical))")
2542+
"unexpected token"
2543+
)

0 commit comments

Comments
 (0)