summaryrefslogtreecommitdiffstats
path: root/test/t/test_java.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/test_java.py')
-rw-r--r--test/t/test_java.py45
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"