Skip to content

Commit f26cbb0

Browse files
feat(snapbox): Add assert_eq! macro
1 parent f4e924c commit f26cbb0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

crates/snapbox/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,14 @@ pub fn assert_subset_matches(
244244
.action_env(DEFAULT_ACTION_ENV)
245245
.subset_matches(pattern_root, actual_root);
246246
}
247+
248+
/// A [`std::assert_eq`] compatible wrapper around the [`Assert`] API.
249+
#[macro_export]
250+
macro_rules! assert_eq {
251+
($left:expr, $right:expr $(,)?) => {
252+
Assert::new().eq($left, $right);
253+
};
254+
($left:expr, $right:expr, $($arg:tt)+) => {
255+
Assert::new().message(format_args!($($arg)+)).eq($left, $right);
256+
};
257+
}

0 commit comments

Comments
 (0)