pub struct Checker<'a> { /* private fields */ }Expand description
Captures expectations about the execution of a command and validates them.
Implementations§
Source§impl<'a> Checker<'a>
impl<'a> Checker<'a>
Sourcepub fn expect_ok(self, stop_reason: StopReason) -> Self
pub fn expect_ok(self, stop_reason: StopReason) -> Self
Expects the invocation to have successfully terminated with the given stop_reason.
If not called, defaults to expecting that execution terminated due to EOF. This or
expect_err can only be called once.
Sourcepub fn expect_compilation_err<S: Into<String>>(self, message: S) -> Self
pub fn expect_compilation_err<S: Into<String>>(self, message: S) -> Self
Expects the invocation to have erroneously terminated with the exact message during
compilation.
If not called, defaults to expecting that execution terminated due to EOF. This or
expect_err can only be called once.
Sourcepub fn expect_err<S: Into<String>>(self, message: S) -> Self
pub fn expect_err<S: Into<String>>(self, message: S) -> Self
Expects the invocation to have erroneously terminated with the exact message.
If not called, defaults to expecting that execution terminated due to EOF. This or
expect_err can only be called once.
Sourcepub fn expect_array<S: AsRef<str>>(
self,
name: S,
subtype: ExprType,
dimensions: &[usize],
contents: Vec<(&[i32], Value)>,
) -> Self
pub fn expect_array<S: AsRef<str>>( self, name: S, subtype: ExprType, dimensions: &[usize], contents: Vec<(&[i32], Value)>, ) -> Self
Adds the name array as an array to expect in the final state of the machine. The array
will be tested to have the same subtype and dimensions, as well as specific contents.
The contents are provided as a collection of subscripts/value pairs to assign to the
expected array.
Sourcepub fn expect_array_simple<S: AsRef<str>>(
self,
name: S,
subtype: ExprType,
contents: Vec<Value>,
) -> Self
pub fn expect_array_simple<S: AsRef<str>>( self, name: S, subtype: ExprType, contents: Vec<Value>, ) -> Self
Adds the name array as an array to expect in the final state of the machine. The array
will be tested to have the same subtype and only one dimension with contents.
Sourcepub fn expect_clear(self) -> Self
pub fn expect_clear(self) -> Self
Adds tracking for all the side-effects of a clear operation on the machine.
Sourcepub fn expect_file<N: Into<String>, C: Into<String>>(
self,
name: N,
content: C,
) -> Self
pub fn expect_file<N: Into<String>, C: Into<String>>( self, name: N, content: C, ) -> Self
Adds a file to expect in the drive with a name and specific content.
name must be the absolute path to the file that is expected, including the drive name.
Sourcepub fn expect_output<V: Into<Vec<CapturedOut>>>(self, out: V) -> Self
pub fn expect_output<V: Into<Vec<CapturedOut>>>(self, out: V) -> Self
Adds the out sequence of captured outputs to the expected outputs of the execution.
Sourcepub fn expect_prints<S: Into<String>, V: Into<Vec<S>>>(self, out: V) -> Self
pub fn expect_prints<S: Into<String>, V: Into<Vec<S>>>(self, out: V) -> Self
Adds the out sequence of strings to the expected outputs of the execution.
This is a convenience function around expect_output that wraps all incoming strings in
CapturedOut::Print objects, as these are the most common outputs in tests.
Sourcepub fn expect_program<S1: Into<String>, S2: Into<String>>(
self,
name: Option<S1>,
text: S2,
) -> Self
pub fn expect_program<S1: Into<String>, S2: Into<String>>( self, name: Option<S1>, text: S2, ) -> Self
Sets the expected name of the stored program to name and its contents to text. Can only
be called once and text must not be empty.
Sourcepub fn expect_var<S: AsRef<str>, V: Into<Value>>(
self,
name: S,
value: V,
) -> Self
pub fn expect_var<S: AsRef<str>, V: Into<Value>>( self, name: S, value: V, ) -> Self
Adds the name/value pair as a variable to expect in the final state of the machine.
Sourcepub fn take_captured_out(&mut self) -> Vec<CapturedOut>
pub fn take_captured_out(&mut self) -> Vec<CapturedOut>
Takes the captured output for separate analysis.