Skip to content

Commit

Permalink
fix(snap): Help catch swapped parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 14, 2024
1 parent 8c604ca commit 952c968
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/snapbox/src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ impl Assert {

#[track_caller]
fn eq_inner(&self, expected: crate::Data, actual: crate::Data) {
if expected.source().is_none() && actual.source().is_some() {
panic!("received `(actual, expected)`, expected `(expected, actual)`");
}
match self.action {
Action::Skip => {
return;
Expand Down Expand Up @@ -108,6 +111,9 @@ impl Assert {

#[track_caller]
fn matches_inner(&self, pattern: crate::Data, actual: crate::Data) {
if pattern.source().is_none() && actual.source().is_some() {
panic!("received `(actual, expected)`, expected `(expected, actual)`");
}
match self.action {
Action::Skip => {
return;
Expand Down

0 comments on commit 952c968

Please sign in to comment.