Fix fuzzy sort score test

This commit is contained in:
ysthakur
2024-08-26 17:28:24 -04:00
parent 53ede1a7b5
commit c8266784c5

View File

@ -245,10 +245,11 @@ mod test {
match_algorithm: MatchAlgorithm::Fuzzy, match_algorithm: MatchAlgorithm::Fuzzy,
..Default::default() ..Default::default()
}; };
let mut matcher = NuMatcher::new("foo bar", options); let mut matcher = NuMatcher::new("fob", options);
for item in ["foo/bar", "bar/foo", "foobar"] { for item in ["foo/bar", "fob", "foo bar"] {
matcher.add(item.to_string(), item); matcher.add(item.to_string(), item);
} }
assert_eq!(vec!["bar/foo", "foo/bar", "foobar"], matcher.results()); // Sort by score, then in alphabetical order
assert_eq!(vec!["fob", "foo bar", "foo/bar"], matcher.results());
} }
} }