mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 14:25:32 +00:00
Added token spectests
This commit is contained in:
parent
c5c033c02b
commit
fd8feedb51
@ -93,7 +93,7 @@ This spectests are currently covered:
|
|||||||
- store_retval.wast ✅
|
- store_retval.wast ✅
|
||||||
- switch.wast ✅
|
- switch.wast ✅
|
||||||
- tee_local.wast ✅
|
- tee_local.wast ✅
|
||||||
- token.wast
|
- token.wast ✅
|
||||||
- traps.wast ✅
|
- traps.wast ✅
|
||||||
- type.wast ✅
|
- type.wast ✅
|
||||||
- typecheck.wast ✅
|
- typecheck.wast ✅
|
||||||
|
10
spectests/token.wast
Normal file
10
spectests/token.wast
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
;; Test tokenization
|
||||||
|
|
||||||
|
(assert_malformed
|
||||||
|
(module quote "(func (drop (i32.const0)))")
|
||||||
|
"unknown operator"
|
||||||
|
)
|
||||||
|
(assert_malformed
|
||||||
|
(module quote "(func br 0drop)")
|
||||||
|
"unknown operator"
|
||||||
|
)
|
@ -13,7 +13,7 @@ static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS";
|
|||||||
static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs).
|
static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs).
|
||||||
// Please do NOT modify it by hand, as it will be reseted on next build.\n";
|
// Please do NOT modify it by hand, as it will be reseted on next build.\n";
|
||||||
|
|
||||||
const TESTS: [&str; 55] = [
|
const TESTS: [&str; 56] = [
|
||||||
"spectests/address.wast",
|
"spectests/address.wast",
|
||||||
"spectests/align.wast",
|
"spectests/align.wast",
|
||||||
"spectests/binary.wast",
|
"spectests/binary.wast",
|
||||||
@ -67,6 +67,7 @@ const TESTS: [&str; 55] = [
|
|||||||
"spectests/store_retval.wast",
|
"spectests/store_retval.wast",
|
||||||
"spectests/switch.wast",
|
"spectests/switch.wast",
|
||||||
"spectests/tee_local.wast",
|
"spectests/tee_local.wast",
|
||||||
|
"spectests/token.wast",
|
||||||
"spectests/traps.wast",
|
"spectests/traps.wast",
|
||||||
"spectests/typecheck.wast",
|
"spectests/typecheck.wast",
|
||||||
"spectests/types.wast",
|
"spectests/types.wast",
|
||||||
|
@ -68,6 +68,7 @@ mod start;
|
|||||||
mod store_retval;
|
mod store_retval;
|
||||||
mod switch;
|
mod switch;
|
||||||
mod tee_local;
|
mod tee_local;
|
||||||
|
mod token;
|
||||||
mod traps;
|
mod traps;
|
||||||
mod typecheck;
|
mod typecheck;
|
||||||
mod types;
|
mod types;
|
||||||
|
32
src/spectests/token.rs
Normal file
32
src/spectests/token.rs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
|
||||||
|
// Please do NOT modify it by hand, as it will be reseted on next build.
|
||||||
|
// Test based on spectests/token.wast
|
||||||
|
#![allow(
|
||||||
|
warnings,
|
||||||
|
dead_code
|
||||||
|
)]
|
||||||
|
use std::panic;
|
||||||
|
use wabt::wat2wasm;
|
||||||
|
|
||||||
|
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, Instance, Export};
|
||||||
|
use super::_common::{
|
||||||
|
spectest_importobject,
|
||||||
|
NaNCheck,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Line 4
|
||||||
|
#[test]
|
||||||
|
fn c0_l4_assert_malformed() {
|
||||||
|
let wasm_binary = [40, 102, 117, 110, 99, 32, 40, 100, 114, 111, 112, 32, 40, 105, 51, 50, 46, 99, 111, 110, 115, 116, 48, 41, 41, 41];
|
||||||
|
let compilation = compile(wasm_binary.to_vec());
|
||||||
|
assert!(compilation.is_err(), "WASM should not compile as is malformed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line 8
|
||||||
|
#[test]
|
||||||
|
fn c1_l8_assert_malformed() {
|
||||||
|
let wasm_binary = [40, 102, 117, 110, 99, 32, 98, 114, 32, 48, 100, 114, 111, 112, 41];
|
||||||
|
let compilation = compile(wasm_binary.to_vec());
|
||||||
|
assert!(compilation.is_err(), "WASM should not compile as is malformed");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user