From 83113998f99bb6d59bb9e94e9ef3e527f4c93f62 Mon Sep 17 00:00:00 2001
From: "F. Levi" <55688616+flevi29@users.noreply.github.com>
Date: Wed, 18 Sep 2024 10:35:23 +0300
Subject: [PATCH] Add more test assertions
---
milli/src/search/new/matches/mod.rs | 36 +++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/milli/src/search/new/matches/mod.rs b/milli/src/search/new/matches/mod.rs
index 09d3db575..8a84f91bd 100644
--- a/milli/src/search/new/matches/mod.rs
+++ b/milli/src/search/new/matches/mod.rs
@@ -929,6 +929,42 @@ mod tests {
matcher.format(format_options),
@"…world between those who embraced progress and those who resisted…"
);
+
+ let builder = MatcherBuilder::new_test(
+ &rtxn,
+ &temp_index,
+ "\"The groundbreaking invention had the power to split the world\"",
+ );
+ let mut matcher = builder.build(text, None);
+ // should highlight "those" and the phrase "and those".
+ insta::assert_snapshot!(
+ matcher.format(format_options),
+ @"The groundbreaking invention had the power to split the world…"
+ );
+
+ let builder = MatcherBuilder::new_test(
+ &rtxn,
+ &temp_index,
+ "\"The groundbreaking invention had the power to split the world between\"",
+ );
+ let mut matcher = builder.build(text, None);
+ // should highlight "those" and the phrase "and those".
+ insta::assert_snapshot!(
+ matcher.format(format_options),
+ @"The groundbreaking invention had the power to split the world …"
+ );
+
+ let builder = MatcherBuilder::new_test(
+ &rtxn,
+ &temp_index,
+ "\"The groundbreaking invention\" \"embraced progress and those who resisted change\"",
+ );
+ let mut matcher = builder.build(text, None);
+ // should highlight "those" and the phrase "and those".
+ insta::assert_snapshot!(
+ matcher.format(format_options),
+ @"…between those who embraced progress and those who resisted change…"
+ );
}
#[test]