pub enum ExpressionDiff {
Equal(Expression),
NotEqual {
expected: Expression,
actual: Expression,
},
Missing(Expression),
Extra(Expression),
Partial {
name: String,
children: Vec<ExpressionDiff>,
},
}Variants§
Implementations§
Source§impl ExpressionDiff
impl ExpressionDiff
pub fn from_expressions( expected: &Expression, actual: &Expression, ignore_missing_expected_values: bool, ) -> ExpressionDiff
pub fn name(&self) -> String
Sourcepub fn print_test_result(&self, colorize: bool) -> FmtResult
pub fn print_test_result(&self, colorize: bool) -> FmtResult
Print this diff to stderr. Intended to be used in a unit test to print the diff when the
evaluation result is a TestError::Diff. This is necessary because, by default, an Err
result is displayed using its Debug value.
Example: fn test () -> Result<(), TestError> { let tester: PestTester<Rule, MyParser> = PestTester::from_defaults(Rule::root_rule); let res = tester.evaluate_strict(“mytest”); if let Err(TestError::Diff { diff }) = res { diff.print_test_result(); } res }
Trait Implementations§
Source§impl Debug for ExpressionDiff
impl Debug for ExpressionDiff
Auto Trait Implementations§
impl Freeze for ExpressionDiff
impl RefUnwindSafe for ExpressionDiff
impl Send for ExpressionDiff
impl Sync for ExpressionDiff
impl Unpin for ExpressionDiff
impl UnwindSafe for ExpressionDiff
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
Mutably borrows from an owned value. Read more