pub struct SimTest {
pub name: Symbol,
pub lib: Symbol,
pub expr: Expr,
pub expected: TestExpected,
pub subjects: Vec<Symbol>,
pub expr_codec: Symbol,
pub expected_codec: Option<Symbol>,
pub example: bool,
pub capabilities: Vec<CapabilityName>,
}Expand description
Executable test or example: an expression, its expectation, and the codec and capability context it runs in.
Fields§
§name: SymbolName the test is registered under.
lib: SymbolLib the test belongs to.
expr: ExprExpression evaluated when the test runs.
expected: TestExpectedExpectation checked against the result.
subjects: Vec<Symbol>Symbols the test exercises, for reporting and discovery.
expr_codec: SymbolCodec the test expression round-trips through before evaluation.
expected_codec: Option<Symbol>Codec the expected value round-trips through, if any.
example: boolWhether the test also serves as a documentation example.
capabilities: Vec<CapabilityName>Capabilities the test requires to run.
Implementations§
Source§impl SimTest
impl SimTest
Sourcepub fn new(
name: Symbol,
lib: Symbol,
expr: Expr,
expected: TestExpected,
subjects: Vec<Symbol>,
) -> Self
pub fn new( name: Symbol, lib: Symbol, expr: Expr, expected: TestExpected, subjects: Vec<Symbol>, ) -> Self
Creates a truthiness-by-default test from its name, lib, expression, expectation, and subjects.
Sourcepub fn with_expr_codec(self, codec: Symbol) -> Self
pub fn with_expr_codec(self, codec: Symbol) -> Self
Sets the expression codec and returns the updated test.
Sourcepub fn with_expected_codec(self, codec: Symbol) -> Self
pub fn with_expected_codec(self, codec: Symbol) -> Self
Sets the expected-value codec and returns the updated test.
Sourcepub fn as_example(self) -> Self
pub fn as_example(self) -> Self
Marks the test as a documentation example and returns it.
Sourcepub fn requiring(self, capability: CapabilityName) -> Self
pub fn requiring(self, capability: CapabilityName) -> Self
Adds a required capability and returns the updated test.
Trait Implementations§
Source§impl Object for SimTest
impl Object for SimTest
Source§fn display(&self, _cx: &mut Cx) -> Result<String>
fn display(&self, _cx: &mut Cx) -> Result<String>
Source§fn header(&self) -> &ObjectHeader
fn header(&self) -> &ObjectHeader
Source§fn op(&self, _key: &OpKey) -> Option<&dyn Op>
fn op(&self, _key: &OpKey) -> Option<&dyn Op>
key, if any.