pub struct ExpectValue { /* private fields */ }Implementations§
Source§impl ExpectValue
impl ExpectValue
pub fn not(self) -> ExpectValue
pub fn soft(self) -> ExpectValue
pub fn with_message(self, message: impl Into<String>) -> ExpectValue
pub fn is_soft(&self) -> bool
pub fn actual(&self) -> &Value
Sourcepub fn to_be(&self, expected: &Value) -> Result<(), AssertionFailure>
pub fn to_be(&self, expected: &Value) -> Result<(), AssertionFailure>
toBe(expected) — strict-equality of primitives. Object/array
values are rejected with guidance to use toEqual.
Sourcepub fn to_equal(&self, expected: &Value) -> Result<(), AssertionFailure>
pub fn to_equal(&self, expected: &Value) -> Result<(), AssertionFailure>
toEqual(expected) — recursive equality. Honours asymmetric
matchers embedded in expected.
Sourcepub fn to_strict_equal(&self, expected: &Value) -> Result<(), AssertionFailure>
pub fn to_strict_equal(&self, expected: &Value) -> Result<(), AssertionFailure>
toStrictEqual(expected) — alias of Self::to_equal for
serde_json::Value (no undefined to differentiate).
pub fn to_be_null(&self) -> Result<(), AssertionFailure>
Sourcepub fn to_be_undefined(&self) -> Result<(), AssertionFailure>
pub fn to_be_undefined(&self) -> Result<(), AssertionFailure>
toBeUndefined is satisfied by null because serde_json cannot
distinguish — the QuickJS binding emits both as Value::Null.
pub fn to_be_defined(&self) -> Result<(), AssertionFailure>
pub fn to_be_truthy(&self) -> Result<(), AssertionFailure>
pub fn to_be_falsy(&self) -> Result<(), AssertionFailure>
pub fn to_be_nan(&self) -> Result<(), AssertionFailure>
pub fn to_be_close_to( &self, expected: f64, digits: Option<u8>, ) -> Result<(), AssertionFailure>
pub fn to_be_greater_than(&self, expected: f64) -> Result<(), AssertionFailure>
pub fn to_be_greater_than_or_equal( &self, expected: f64, ) -> Result<(), AssertionFailure>
pub fn to_be_less_than(&self, expected: f64) -> Result<(), AssertionFailure>
pub fn to_be_less_than_or_equal( &self, expected: f64, ) -> Result<(), AssertionFailure>
Sourcepub fn to_contain(&self, expected: &Value) -> Result<(), AssertionFailure>
pub fn to_contain(&self, expected: &Value) -> Result<(), AssertionFailure>
toContain — primitive membership in array, substring in string.
Sourcepub fn to_contain_equal(&self, expected: &Value) -> Result<(), AssertionFailure>
pub fn to_contain_equal(&self, expected: &Value) -> Result<(), AssertionFailure>
Deep toContain — every element compared by deep_equal.
pub fn to_have_length(&self, expected: usize) -> Result<(), AssertionFailure>
Sourcepub fn to_have_property(
&self,
path: &Value,
expected: Option<&Value>,
) -> Result<(), AssertionFailure>
pub fn to_have_property( &self, path: &Value, expected: Option<&Value>, ) -> Result<(), AssertionFailure>
toHaveProperty(path, value?) — path may be "a.b.c" or a
JSON array of keys / indexes.
Sourcepub fn to_match(&self, pattern: &StringOrRegex) -> Result<(), AssertionFailure>
pub fn to_match(&self, pattern: &StringOrRegex) -> Result<(), AssertionFailure>
Jest’s toMatch(string) is substring containment; toMatch(/re/)
is regex. Differs from StringOrRegex::matches (which is
exact-equality for the string variant).
pub fn to_match_object(&self, subset: &Value) -> Result<(), AssertionFailure>
Sourcepub fn to_be_instance_of(
&self,
ctor_name: &str,
actual_ctor_name: Option<&str>,
) -> Result<(), AssertionFailure>
pub fn to_be_instance_of( &self, ctor_name: &str, actual_ctor_name: Option<&str>, ) -> Result<(), AssertionFailure>
toBeInstanceOf(ctorName) — checked against the binding-supplied
constructor name (Class.name). When actual_ctor_name is
None, falls back to the inferred built-in (e.g. Array for an
array value).
Auto Trait Implementations§
impl Freeze for ExpectValue
impl RefUnwindSafe for ExpectValue
impl Send for ExpectValue
impl Sync for ExpectValue
impl Unpin for ExpectValue
impl UnsafeUnpin for ExpectValue
impl UnwindSafe for ExpectValue
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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