From a9c7d8269308e6e145437c5ff7de952fed8bbad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Thu, 4 Aug 2022 11:04:07 +0200 Subject: [PATCH] Switch to snapshot tests for search/criteria/attribute.rs --- milli/src/search/criteria/attribute.rs | 72 +++++++++++++++++++------- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/milli/src/search/criteria/attribute.rs b/milli/src/search/criteria/attribute.rs index 3d67b60c0..d8feeeee9 100644 --- a/milli/src/search/criteria/attribute.rs +++ b/milli/src/search/criteria/attribute.rs @@ -632,25 +632,59 @@ mod tests { ]), ], ); - - let expected = vec![ - vec![vec![Query { prefix: false, kind: QueryKind::exact(S("manythefish")) }]], - vec![ - vec![Query { prefix: false, kind: QueryKind::exact(S("manythe")) }], - vec![Query { prefix: false, kind: QueryKind::exact(S("fish")) }], - ], - vec![ - vec![Query { prefix: false, kind: QueryKind::exact(S("many")) }], - vec![Query { prefix: false, kind: QueryKind::exact(S("thefish")) }], - ], - vec![ - vec![Query { prefix: false, kind: QueryKind::exact(S("many")) }], - vec![Query { prefix: false, kind: QueryKind::exact(S("the")) }], - vec![Query { prefix: false, kind: QueryKind::exact(S("fish")) }], - ], - ]; - let result = flatten_query_tree(&query_tree); - assert_eq!(expected, result); + + insta::assert_debug_snapshot!(result, @r###" + [ + [ + [ + Exact { + word: "manythefish", + }, + ], + ], + [ + [ + Exact { + word: "manythe", + }, + ], + [ + Exact { + word: "fish", + }, + ], + ], + [ + [ + Exact { + word: "many", + }, + ], + [ + Exact { + word: "thefish", + }, + ], + ], + [ + [ + Exact { + word: "many", + }, + ], + [ + Exact { + word: "the", + }, + ], + [ + Exact { + word: "fish", + }, + ], + ], + ] + "###); } }