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.Source§impl ObjectCompat for SimTest
impl ObjectCompat for SimTest
Source§fn class(&self, cx: &mut Cx) -> Result<ClassRef>
fn class(&self, cx: &mut Cx) -> Result<ClassRef>
Source§fn as_expr(&self, _cx: &mut Cx) -> Result<Expr>
fn as_expr(&self, _cx: &mut Cx) -> Result<Expr>
Source§fn as_table(&self, cx: &mut Cx) -> Result<Value>
fn as_table(&self, cx: &mut Cx) -> Result<Value>
Source§fn as_callable(&self) -> Option<&dyn Callable>
fn as_callable(&self) -> Option<&dyn Callable>
Source§fn as_object_encoder(&self) -> Option<&dyn ObjectEncode>
fn as_object_encoder(&self) -> Option<&dyn ObjectEncode>
Source§fn as_read_constructor(&self) -> Option<&dyn ReadConstructor>
fn as_read_constructor(&self) -> Option<&dyn ReadConstructor>
Source§fn as_number_domain(&self) -> Option<&(dyn NumberDomain + 'static)>
fn as_number_domain(&self) -> Option<&(dyn NumberDomain + 'static)>
Source§fn as_number_value(&self) -> Option<&dyn NumberValue>
fn as_number_value(&self) -> Option<&dyn NumberValue>
Source§fn as_eval_fabric(&self) -> Option<&dyn EvalFabric>
fn as_eval_fabric(&self) -> Option<&dyn EvalFabric>
Source§fn as_sequence(&self) -> Option<&dyn Sequence>
fn as_sequence(&self) -> Option<&dyn Sequence>
Source§fn as_list(&self) -> Option<&(dyn ListValue + 'static)>
fn as_list(&self) -> Option<&(dyn ListValue + 'static)>
Source§fn as_table_impl(&self) -> Option<&(dyn Table + 'static)>
fn as_table_impl(&self) -> Option<&(dyn Table + 'static)>
Source§fn as_dir(&self) -> Option<&(dyn Dir + 'static)>
fn as_dir(&self) -> Option<&(dyn Dir + 'static)>
Auto Trait Implementations§
impl Freeze for SimTest
impl RefUnwindSafe for SimTest
impl Send for SimTest
impl Sync for SimTest
impl Unpin for SimTest
impl UnsafeUnpin for SimTest
impl UnwindSafe for SimTest
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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