pub struct Wast {
current: Option<Instance>,
import_object: Imports,
instances: HashMap<String, Instance>,
allowed_instantiation_failures: HashSet<String>,
allowed_directive_failures: HashSet<(PathBuf, usize, String)>,
match_trap_messages: Vec<(String, String)>,
current_is_allowed_failure: bool,
store: Store,
pub fail_fast: bool,
disable_assert_trap_exhaustion: bool,
disable_assert_exception: bool,
}Expand description
The wast test script language allows modules to be defined and actions to be performed on them.
Fields§
§current: Option<Instance>Wast files have a concept of a “current” module, which is the most recently defined.
import_object: ImportsThe Import Object that all wast tests will have
instances: HashMap<String, Instance>The instances in the test
allowed_instantiation_failures: HashSet<String>Allowed failures (ideally this should be empty)
allowed_directive_failures: HashSet<(PathBuf, usize, String)>Allowed directive failures in a specific file at a specific 1-based line.
match_trap_messages: Vec<(String, String)>If the (expected from .wast, actual) message pair is in this list, treat the strings as matching.
current_is_allowed_failure: boolIf the current module was an allowed failure, we allow test to fail
store: StoreThe store in which the tests are executing.
fail_fast: boolA flag indicating if Wast tests should stop as soon as one test fails.
disable_assert_trap_exhaustion: boolA flag indicating that assert_trap and assert_exhaustion should be skipped. See https://github.com/wasmerio/wasmer/issues/1550 for more info
disable_assert_exception: boolA flag indicating that assert_exception should be skipped.
Implementations§
Source§impl Wast
impl Wast
Sourcepub fn new(store: Store, import_object: Imports) -> Self
pub fn new(store: Store, import_object: Imports) -> Self
Construct a new instance of Wast with a given imports.
Sourcepub fn allow_instantiation_failures(&mut self, failures: &[&str])
pub fn allow_instantiation_failures(&mut self, failures: &[&str])
A list of instantiation failures to allow.
Sourcepub fn allow_directive_failures_at_line(
&mut self,
line: usize,
filename: &str,
failure: &str,
)
pub fn allow_directive_failures_at_line( &mut self, line: usize, filename: &str, failure: &str, )
A directive failure to allow in a specific file at a specific 1-based line.
Sourcepub fn allow_trap_message(&mut self, expected: &str, allowed: &str)
pub fn allow_trap_message(&mut self, expected: &str, allowed: &str)
A list of alternative messages to permit for a trap failure.
Sourcepub fn disable_assert_and_exhaustion(&mut self)
pub fn disable_assert_and_exhaustion(&mut self)
Do not run any code in assert_trap or assert_exhaustion.
Sourcepub fn disable_assert_exception(&mut self)
pub fn disable_assert_exception(&mut self)
Do not run any code in assert_exception.
Sourcepub fn new_with_spectest(store: Store) -> Self
pub fn new_with_spectest(store: Store) -> Self
Construct a new instance of Wast with the spectests imports.
fn get_instance(&self, instance_name: Option<&str>) -> Result<Instance>
Sourcefn perform_execute(&mut self, exec: WastExecute<'_>) -> Result<Vec<Value>>
fn perform_execute(&mut self, exec: WastExecute<'_>) -> Result<Vec<Value>>
Perform the action portion of a command.
fn perform_invoke(&mut self, exec: WastInvoke<'_>) -> Result<Vec<Value>>
fn assert_return( &self, result: Result<Vec<Value>>, results: &[WastRet<'_>], ) -> Result<()>
fn assert_trap(&self, result: Result<Vec<Value>>, expected: &str) -> Result<()>
fn run_directive( &mut self, _test: &Path, directive: WastDirective<'_>, ) -> Result<()>
Source§impl Wast
impl Wast
Sourcefn module(&mut self, instance_name: Option<&str>, module: &[u8]) -> Result<()>
fn module(&mut self, instance_name: Option<&str>, module: &[u8]) -> Result<()>
Define a module and register it.
fn instantiate(&mut self, module: &[u8]) -> Result<Instance>
Sourcefn register(&mut self, name: Option<&str>, as_name: &str) -> Result<()>
fn register(&mut self, name: Option<&str>, as_name: &str) -> Result<()>
Register an instance to make it available for performing actions.
Sourcefn invoke(
&mut self,
instance_name: Option<&str>,
field: &str,
args: &[Value],
) -> Result<Vec<Value>>
fn invoke( &mut self, instance_name: Option<&str>, field: &str, args: &[Value], ) -> Result<Vec<Value>>
Invoke an exported function from an instance.
Sourcefn get(
&mut self,
instance_name: Option<&str>,
field: &str,
) -> Result<Vec<Value>>
fn get( &mut self, instance_name: Option<&str>, field: &str, ) -> Result<Vec<Value>>
Get the value of an exported global from an instance.
Sourcefn runtime_value(&mut self, v: &WastArgCore<'_>) -> Result<Value>
fn runtime_value(&mut self, v: &WastArgCore<'_>) -> Result<Value>
Translate from a script::Value to a Value.
fn matches_message_assert_unlinkable(expected: &str, actual: &str) -> bool
fn matches_message_assert_invalid(expected: &str, actual: &str) -> bool
fn matches_message_assert_trap(&self, expected: &str, actual: &str) -> bool
fn assert_exception(&self, result: Result<Vec<Value>>) -> Result<()>
fn val_matches( &self, actual: &Value, expected: &WastRetCore<'_>, ) -> Result<bool>
Auto Trait Implementations§
impl !RefUnwindSafe for Wast
impl !Send for Wast
impl !Sync for Wast
impl !UnwindSafe for Wast
impl Freeze for Wast
impl Unpin for Wast
impl UnsafeUnpin for Wast
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more