From 83991ee7704a6626a63728b111e3f603a7e7de6c Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 8 Aug 2023 16:28:38 +0200 Subject: [PATCH] enable the multi-snapshot attribute in insta. This will let us use insta in loops --- meili-snap/src/lib.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/meili-snap/src/lib.rs b/meili-snap/src/lib.rs index 32d3385d9..c467aef49 100644 --- a/meili-snap/src/lib.rs +++ b/meili-snap/src/lib.rs @@ -167,7 +167,9 @@ macro_rules! snapshot { let (settings, snap_name, _) = $crate::default_snapshot_settings_for_test(test_name, Some(&snap_name)); settings.bind(|| { let snap = format!("{}", $value); - meili_snap::insta::assert_snapshot!(format!("{}", snap_name), snap); + insta::allow_duplicates! { + meili_snap::insta::assert_snapshot!(format!("{}", snap_name), snap); + } }); }; ($value:expr, @$inline:literal) => { @@ -176,7 +178,9 @@ macro_rules! snapshot { let (settings, _, _) = $crate::default_snapshot_settings_for_test("", Some("_dummy_argument")); settings.bind(|| { let snap = format!("{}", $value); - meili_snap::insta::assert_snapshot!(snap, @$inline); + insta::allow_duplicates! { + meili_snap::insta::assert_snapshot!(snap, @$inline); + } }); }; ($value:expr) => { @@ -194,7 +198,9 @@ macro_rules! snapshot { let (settings, snap_name, _) = $crate::default_snapshot_settings_for_test(test_name, None); settings.bind(|| { let snap = format!("{}", $value); - meili_snap::insta::assert_snapshot!(format!("{}", snap_name), snap); + insta::allow_duplicates! { + meili_snap::insta::assert_snapshot!(format!("{}", snap_name), snap); + } }); }; }