From 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:03:19 +0200 Subject: Merging upstream version 1:2.12.0. Signed-off-by: Daniel Baumann --- test/t/test_java.py | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) (limited to 'test/t/test_java.py') 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" -- cgit v1.2.3