Skip to content

Commit

Permalink
[test] Unify the error message.
Browse files Browse the repository at this point in the history
1. "array is immutable" for trying to assign values into an immutable
   array in validation.
2. "out of bounds array access" for trying to access out of bounds array
   in execution.

Signed-off-by: YiYing He <yiying@secondstate.io>
  • Loading branch information
q82419 committed Dec 1, 2023
1 parent 026ffea commit adbec76
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions test/core/gc/array.wast
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
(assert_return (invoke "set_get" (i32.const 1) (f32.const 7)) (f32.const 7))
(assert_return (invoke "len") (i32.const 3))

(assert_trap (invoke "get" (i32.const 10)) "out of bounds")
(assert_trap (invoke "set_get" (i32.const 10) (f32.const 7)) "out of bounds")
(assert_trap (invoke "get" (i32.const 10)) "out of bounds array access")
(assert_trap (invoke "set_get" (i32.const 10) (f32.const 7)) "out of bounds array access")

(module
(type $vec (array f32))
Expand Down Expand Up @@ -145,8 +145,8 @@
(assert_return (invoke "set_get" (i32.const 1) (f32.const 7)) (f32.const 7))
(assert_return (invoke "len") (i32.const 2))

(assert_trap (invoke "get" (i32.const 10)) "out of bounds")
(assert_trap (invoke "set_get" (i32.const 10) (f32.const 7)) "out of bounds")
(assert_trap (invoke "get" (i32.const 10)) "out of bounds array access")
(assert_trap (invoke "set_get" (i32.const 10) (f32.const 7)) "out of bounds array access")

(module
(type $vec (array i8))
Expand Down Expand Up @@ -190,8 +190,8 @@
(assert_return (invoke "set_get" (i32.const 1) (i32.const 7)) (i32.const 7))
(assert_return (invoke "len") (i32.const 3))

(assert_trap (invoke "get" (i32.const 10)) "out of bounds")
(assert_trap (invoke "set_get" (i32.const 10) (i32.const 7)) "out of bounds")
(assert_trap (invoke "get" (i32.const 10)) "out of bounds array access")
(assert_trap (invoke "set_get" (i32.const 10) (i32.const 7)) "out of bounds array access")

(module
(type $bvec (array i8))
Expand Down Expand Up @@ -249,8 +249,8 @@
(assert_return (invoke "set_get" (i32.const 0) (i32.const 1) (i32.const 1)) (i32.const 2))
(assert_return (invoke "len") (i32.const 2))

(assert_trap (invoke "get" (i32.const 10) (i32.const 0)) "out of bounds")
(assert_trap (invoke "set_get" (i32.const 10) (i32.const 0) (i32.const 0)) "out of bounds")
(assert_trap (invoke "get" (i32.const 10) (i32.const 0)) "out of bounds array access")
(assert_trap (invoke "set_get" (i32.const 10) (i32.const 0) (i32.const 0)) "out of bounds array access")

(assert_invalid
(module
Expand Down
2 changes: 1 addition & 1 deletion test/core/gc/array_copy.wast
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(array.copy $a $b (local.get $1) (i32.const 0) (local.get $2) (i32.const 0) (i32.const 0))
)
)
"destination array is immutable"
"array is immutable"
)

(assert_invalid
Expand Down

0 comments on commit adbec76

Please sign in to comment.