Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Type validation after unreachable select #522

Merged
merged 1 commit into from
Sep 8, 2020
Merged
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
37 changes: 37 additions & 0 deletions test/unittests/validation_stack_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,4 +891,41 @@ TEST(validation_stack_type, unreachable_select)
*/
const auto wasm_mismatch5 = from_hex("0061736d01000000010401600000030201000a06010400001b0b");
EXPECT_THROW_MESSAGE(parse(wasm_mismatch5), validation_error, "too many results");

/* wat2wasm
(func (result i32)
unreachable
select
i32.add
)
*/

const auto wasm_mismatch6 =
from_hex("0061736d010000000105016000017f030201000a07010500001b6a0b");
EXPECT_NO_THROW(parse(wasm_mismatch6));

/* wat2wasm
(func (result i32)
unreachable
i32.const 0
select
i32.add
)
*/

const auto wasm_mismatch7 =
from_hex("0061736d010000000105016000017f030201000a090107000041001b6a0b");
EXPECT_NO_THROW(parse(wasm_mismatch7));

/* wat2wasm --no-check
(func (result i32)
unreachable
i64.const 0
select
i32.add
)
*/
const auto wasm_mismatch8 =
from_hex("0061736d010000000105016000017f030201000a090107000042001b6a0b");
EXPECT_THROW_MESSAGE(parse(wasm_mismatch8), validation_error, "type mismatch");
}