Skip to content

Commit

Permalink
feat(snapbox): Add assert_eq! macro
Browse files Browse the repository at this point in the history
  • Loading branch information
not-my-profile committed Aug 18, 2023
1 parent f4e924c commit f26cbb0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/snapbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,14 @@ pub fn assert_subset_matches(
.action_env(DEFAULT_ACTION_ENV)
.subset_matches(pattern_root, actual_root);
}

/// A [`std::assert_eq`] compatible wrapper around the [`Assert`] API.
#[macro_export]
macro_rules! assert_eq {
($left:expr, $right:expr $(,)?) => {
Assert::new().eq($left, $right);
};
($left:expr, $right:expr, $($arg:tt)+) => {
Assert::new().message(format_args!($($arg)+)).eq($left, $right);
};
}

0 comments on commit f26cbb0

Please sign in to comment.