Enum cranelift_reader::RunCommand
source · pub enum RunCommand {
Print(Invocation),
Run(Invocation, Comparison, Vec<DataValue>),
}
Expand description
A run command appearing in a test file.
For parsing, see Parser::parse_run_command
Variants§
Print(Invocation)
Invoke a function and print its result.
Run(Invocation, Comparison, Vec<DataValue>)
Invoke a function and compare its result to a value sequence.
Implementations§
source§impl RunCommand
impl RunCommand
sourcepub fn run<F>(&self, invoke_fn: F) -> Result<(), String>where
F: FnOnce(&str, &[DataValue]) -> Result<Vec<DataValue>, String>,
pub fn run<F>(&self, invoke_fn: F) -> Result<(), String>where F: FnOnce(&str, &[DataValue]) -> Result<Vec<DataValue>, String>,
Run the RunCommand:
- for RunCommand::Print, print the returned values from invoking the function.
- for RunCommand::Run, compare the returned values from the invoked function and
return an
Err
with a descriptive string if the comparison fails.
Accepts a function used for invoking the actual execution of the command. This function,
invoked_fn
, is passed the function name and function arguments of the Invocation.
Trait Implementations§
source§impl Debug for RunCommand
impl Debug for RunCommand
source§impl Display for RunCommand
impl Display for RunCommand
source§impl PartialEq<RunCommand> for RunCommand
impl PartialEq<RunCommand> for RunCommand
source§fn eq(&self, other: &RunCommand) -> bool
fn eq(&self, other: &RunCommand) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.