mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-15 09:21:15 -03:00
Simplify and add tests for ifind
This commit is contained in:
@@ -1731,6 +1731,17 @@ static void test_fuzzy_match() {
|
||||
err(L"test_fuzzy_match failed on line %ld", __LINE__);
|
||||
}
|
||||
|
||||
static void test_ifind() {
|
||||
say(L"Testing ifind");
|
||||
do_test(ifind(std::string{"alpha"}, std::string{"alpha"}) == 0);
|
||||
do_test(ifind(wcstring{L"alphab"}, wcstring{L"alpha"}) == 0);
|
||||
do_test(ifind(std::string{"alpha"}, std::string{"balpha"}) == std::string::npos);
|
||||
do_test(ifind(std::string{"balpha"}, std::string{"alpha"}) == 1);
|
||||
do_test(ifind(std::string{"alphab"}, std::string{"balpha"}) == std::string::npos);
|
||||
do_test(ifind(std::string{"balpha"}, std::string{"lPh"}) == 2);
|
||||
do_test(ifind(std::string{"balpha"}, std::string{"Plh"}) == std::string::npos);
|
||||
}
|
||||
|
||||
static void test_abbreviations() {
|
||||
say(L"Testing abbreviations");
|
||||
env_push(true);
|
||||
@@ -4786,6 +4797,7 @@ int main(int argc, char **argv) {
|
||||
if (should_test_function("lru")) test_lru();
|
||||
if (should_test_function("expand")) test_expand();
|
||||
if (should_test_function("fuzzy_match")) test_fuzzy_match();
|
||||
if (should_test_function("ifind")) test_ifind();
|
||||
if (should_test_function("abbreviations")) test_abbreviations();
|
||||
if (should_test_function("test")) test_test();
|
||||
if (should_test_function("path")) test_path();
|
||||
|
||||
Reference in New Issue
Block a user