From dae0f63e5ba0a1c05f2a9b70b5e0f86bb532a4f5 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 4 Feb 2016 12:45:09 -0800 Subject: Prefer special autosuggestions to match case Fixes #2672 --- src/fish_tests.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/fish_tests.cpp') diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index 90d9dadc..f875438d 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -2302,7 +2302,7 @@ static void test_completion_insertions() static void perform_one_autosuggestion_special_test(const wcstring &command, const wcstring &wd, const wcstring &expected, long line) { wcstring suggestion; - bool success = autosuggest_suggest_special(command, wd, suggestion); + bool success = autosuggest_suggest_special(command, wd, &suggestion); if (! success) { printf("line %ld: autosuggest_suggest_special() failed for command %ls\n", line, command.c_str()); @@ -2330,8 +2330,11 @@ static void test_autosuggest_suggest_special() if (system("mkdir -p /tmp/autosuggest_test/start/unique2/unique3/multi4")) err(L"mkdir failed"); if (system("mkdir -p /tmp/autosuggest_test/start/unique2/unique3/multi42")) err(L"mkdir failed"); if (system("mkdir -p /tmp/autosuggest_test/start/unique2/.hiddenDir/moreStuff")) err(L"mkdir failed"); - + const wcstring wd = L"/tmp/autosuggest_test/"; + + env_set(L"AUTOSUGGEST_TEST_LOC", wd.c_str(), ENV_LOCAL); + perform_one_autosuggestion_special_test(L"cd /tmp/autosuggest_test/0", wd, L"cd /tmp/autosuggest_test/0foobar/", __LINE__); perform_one_autosuggestion_special_test(L"cd \"/tmp/autosuggest_test/0", wd, L"cd \"/tmp/autosuggest_test/0foobar/\"", __LINE__); perform_one_autosuggestion_special_test(L"cd '/tmp/autosuggest_test/0", wd, L"cd '/tmp/autosuggest_test/0foobar/'", __LINE__); @@ -2373,6 +2376,8 @@ static void test_autosuggest_suggest_special() perform_one_autosuggestion_special_test(L"cd 5", wd, L"cd 5foo\\\"bar/", __LINE__); perform_one_autosuggestion_special_test(L"cd \"5", wd, L"cd \"5foo\\\"bar/\"", __LINE__); perform_one_autosuggestion_special_test(L"cd '5", wd, L"cd '5foo\"bar/'", __LINE__); + + //perform_one_autosuggestion_special_test(L"cd $AUTOSUGGEST_TEST_LOC/0", wd, L"cd $AUTOSUGGEST_TEST_LOC/0foobar/", __LINE__); perform_one_autosuggestion_special_test(L"cd ~/test_autosuggest_suggest_specia", wd, L"cd ~/test_autosuggest_suggest_special/", __LINE__); -- cgit v1.2.3