Struct wasmer_wast::Wast
source · pub struct Wast {
current: Option<Instance>,
import_object: Imports,
instances: HashMap<String, Instance>,
allowed_instantiation_failures: HashSet<String>,
match_trap_messages: HashMap<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: Imports
The 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)
match_trap_messages: HashMap<String, String>
If the (expected from .wast, actual) message pair is in this list, treat the strings as matching.
current_is_allowed_failure: bool
If the current module was an allowed failure, we allow test to fail
store: Store
The store in which the tests are executing.
fail_fast: bool
A flag indicating if Wast tests should stop as soon as one test fails.
disable_assert_trap_exhaustion: bool
A 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: bool
A 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_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 Freeze for Wast
impl !RefUnwindSafe for Wast
impl Send for Wast
impl Sync for Wast
impl Unpin for Wast
impl !UnwindSafe 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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