diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:19 +0000 |
commit | 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde (patch) | |
tree | 0221189d367bf661f6f9493c4f17a03f0dd4b7d2 /test/t/test_java.py | |
parent | Releasing progress-linux version 1:2.11-8~progress7.99u1. (diff) | |
download | bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.tar.xz bash-completion-6c09f2a45c5541e9c207d14fc7aa21a4a0066bde.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/t/test_java.py')
-rw-r--r-- | test/t/test_java.py | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/test/t/test_java.py b/test/t/test_java.py index ce0f773..03f1520 100644 --- a/test/t/test_java.py +++ b/test/t/test_java.py @@ -1,6 +1,6 @@ import pytest -from conftest import is_bash_type +from conftest import is_bash_type, assert_bash_exec, bash_env_saved @pytest.mark.bashcomp( @@ -47,3 +47,46 @@ class TestJava: @pytest.mark.complete("java -jar java/") def test_6(self, completion): assert completion == "a/ bashcomp.jar bashcomp.war".split() + + @pytest.mark.complete("javadoc -sourcepath java/a:java/a/c ") + def test_sourcepath_1(self, completion): + """sourcepath should be split by `:`""" + assert completion == "c" + + @pytest.mark.complete("javadoc -sourcepath java/?:java/x ") + def test_sourcepath_2(self, completion): + """pathname expansion should not happen after splitting the argument by + `:`""" + assert not completion + + @pytest.mark.complete("javadoc -sourcepath java/a ") + def test_packages_1(self, completion): + assert completion == "c" + + @pytest.mark.complete("javadoc -sourcepath java/a x") + def test_packages_2(self, completion): + assert not completion + + @pytest.mark.complete( + "javadoc -sourcepath java/a x", shopt=dict(failglob=True) + ) + def test_packages_3(self, completion): + assert not completion + + @pytest.mark.complete("javadoc -sourcepath java/a ", env=dict(IFS="a")) + def test_packages_4(self, completion): + assert completion == "c" + + def test_packages_5(self, bash): + """_comp_cmd_java__packages should not modify the outerscope `cur`""" + with bash_env_saved(bash) as bash_env: + bash_env.write_variable("cur", "a.b.c") + assert_bash_exec( + bash, + "_comp_test_f() { local cword=3 words=(javadoc -sourcepath java/a a.b.c); COMPREPLY+=(); _comp_cmd_java__packages; }; _comp_test_f", + ) + + @pytest.mark.complete("javadoc -sourcepath java a.") + def test_packages_6(self, completion): + """A period in package names should not be converted to slash.""" + assert completion == "c" |