mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 04:39:39 +08:00
Correct check and add a basic test for fuzzy_match_substring_case_insensitive
This commit is contained in:
parent
5efa18da15
commit
fcd4a44b98
@ -1848,7 +1848,7 @@ string_fuzzy_match_t string_fuzzy_match_string(const wcstring &string,
|
||||
assert(match_against.size() >= string.size());
|
||||
result.match_distance_first = match_against.size() - string.size();
|
||||
result.match_distance_second = location; // prefer earlier matches
|
||||
} else if (limit_type >= fuzzy_match_substring &&
|
||||
} else if (limit_type >= fuzzy_match_substring_case_insensitive &&
|
||||
(location = ifind(match_against, string)) != wcstring::npos) {
|
||||
// A case-insensitive version of the string is in the match against.
|
||||
result.type = fuzzy_match_substring_case_insensitive;
|
||||
|
@ -1723,6 +1723,8 @@ static void test_fuzzy_match() {
|
||||
err(L"test_fuzzy_match failed on line %ld", __LINE__);
|
||||
if (string_fuzzy_match_string(L"LPH", L"ALPHA!").type != fuzzy_match_substring)
|
||||
err(L"test_fuzzy_match failed on line %ld", __LINE__);
|
||||
if (string_fuzzy_match_string(L"lPh", L"ALPHA!").type != fuzzy_match_substring_case_insensitive)
|
||||
err(L"test_fuzzy_match failed on line %ld", __LINE__);
|
||||
if (string_fuzzy_match_string(L"AA", L"ALPHA!").type != fuzzy_match_subsequence_insertions_only)
|
||||
err(L"test_fuzzy_match failed on line %ld", __LINE__);
|
||||
if (string_fuzzy_match_string(L"BB", L"ALPHA!").type != fuzzy_match_none)
|
||||
|
Loading…
x
Reference in New Issue
Block a user