-
Notifications
You must be signed in to change notification settings - Fork 400
fix(java,rsync,ssh): complete syntactically incomplete cur #1485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missed in the review and already merged, but I think this is a filename that will cause problems e.g. on Windows, and it would be better created dynamically.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import pytest | ||
|
|
||
| from conftest import assert_bash_exec | ||
|
|
||
|
|
||
| @pytest.mark.bashcomp( | ||
| cmd=None, | ||
| cwd="_filedir", | ||
| ignore_env=r"^\+declare -f __tester$", | ||
| ) | ||
| class TestDequoteIncomplete: | ||
| @pytest.fixture | ||
| def functions(self, bash): | ||
| assert_bash_exec( | ||
| bash, | ||
| '__tester() { local REPLY=dummy v=var;_comp_dequote_incomplete "$1";local ext=$?;((${#REPLY[@]}))&&printf \'<%s>\' "${REPLY[@]}";echo;return $ext;}', | ||
| ) | ||
|
|
||
| def test_basic_1(self, bash, functions): | ||
| output = assert_bash_exec(bash, "__tester a", want_output=True) | ||
| assert output.strip() == "<a>" | ||
|
|
||
| def test_basic_2(self, bash, functions): | ||
| output = assert_bash_exec(bash, "__tester abc", want_output=True) | ||
| assert output.strip() == "<abc>" | ||
|
|
||
| def test_basic_3_null(self, bash, functions): | ||
| output = assert_bash_exec(bash, "! __tester ''", want_output=True) | ||
| assert output.strip() == "" | ||
|
|
||
| def test_basic_4_empty(self, bash, functions): | ||
| output = assert_bash_exec(bash, "__tester \"''\"", want_output=True) | ||
| assert output.strip() == "<>" | ||
|
|
||
| def test_basic_5_brace(self, bash, functions): | ||
| output = assert_bash_exec(bash, "__tester 'a{1..3}'", want_output=True) | ||
| assert output.strip() == "<a1><a2><a3>" | ||
|
|
||
| def test_basic_6_glob(self, bash, functions): | ||
| output = assert_bash_exec(bash, "__tester 'a?b'", want_output=True) | ||
| assert output.strip() == "<a b><a$b><a&b><a'b>" | ||
|
|
||
| def test_quote_1(self, bash, functions): | ||
| output = assert_bash_exec( | ||
| bash, "__tester '\"a\"'\\'b\\'\\$\\'c\\'", want_output=True | ||
| ) | ||
| assert output.strip() == "<abc>" | ||
|
|
||
| def test_quote_2(self, bash, functions): | ||
| output = assert_bash_exec( | ||
| bash, "__tester '\\\"\\'\\''\\$\\`'", want_output=True | ||
| ) | ||
| assert output.strip() == "<\"'$`>" | ||
|
|
||
| def test_quote_3(self, bash, functions): | ||
| output = assert_bash_exec( | ||
| bash, r"__tester \$\'a\\tb\'", want_output=True | ||
| ) | ||
| assert output.strip() == "<a\tb>" | ||
|
|
||
| def test_quote_4(self, bash, functions): | ||
| output = assert_bash_exec( | ||
| bash, '__tester \'"abc\\"def"\'', want_output=True | ||
| ) | ||
| assert output.strip() == '<abc"def>' | ||
|
|
||
| def test_quote_5(self, bash, functions): | ||
| output = assert_bash_exec( | ||
| bash, r"__tester \'abc\'\\\'\'def\'", want_output=True | ||
| ) | ||
| assert output.strip() == "<abc'def>" | ||
|
|
||
| def test_incomplete_1(self, bash, functions): | ||
| output = assert_bash_exec(bash, r"__tester 'a\'", want_output=True) | ||
| assert output.strip() == "<a>" | ||
|
|
||
| def test_incomplete_2(self, bash, functions): | ||
| output = assert_bash_exec(bash, '__tester "\'a b "', want_output=True) | ||
| assert output.strip() == "<a b >" | ||
|
|
||
| def test_incomplete_3(self, bash, functions): | ||
| output = assert_bash_exec(bash, "__tester '\"a b '", want_output=True) | ||
| assert output.strip() == "<a b >" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not immediately clear to me why we'd do this when completing java packages, the commit messages nor the referenced issues don't mention it either, and there's seemingly no test suite coverage for it. Is it necessary, and if yes, can we somehow clarify why and add test cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With
javadoc 'a[tab],curbecomes an incomplete wordcur="'a". If we use_comp_dequote, nothing is completed because modules starting with'aare not found. In dealing with a value coming fromcur, we need to use_comp_dequote_incompletein general.main, and I added a test case intest/t/test_javadoc.py._comp_dequoteand_comp_dequote_incomplete.