From 0bc58b66a4850cdb8458a86c3d9a2fc81de82aa3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:14:42 +0200 Subject: Adding upstream version 1:2.11. Signed-off-by: Daniel Baumann --- test/t/test_java.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/t/test_java.py (limited to 'test/t/test_java.py') diff --git a/test/t/test_java.py b/test/t/test_java.py new file mode 100644 index 0000000..ce0f773 --- /dev/null +++ b/test/t/test_java.py @@ -0,0 +1,49 @@ +import pytest + +from conftest import is_bash_type + + +@pytest.mark.bashcomp( + pre_cmds=("CLASSPATH=$PWD/java/a:$PWD/java/bashcomp.jar",) +) +class TestJava: + @pytest.fixture(scope="class") + def can_list_jar(self, bash): + return ( + is_bash_type(bash, "zipinfo") + or is_bash_type(bash, "unzip") + or is_bash_type(bash, "jar") + ) + + @pytest.mark.complete("java -", require_cmd=True) + def test_1(self, completion): + assert completion + + @pytest.mark.complete("java ") + def test_2(self, completion, can_list_jar): + if can_list_jar: + assert completion == "b bashcomp.jarred c. toplevel".split() + else: + assert completion == "b c.".split() + + @pytest.mark.complete("java -classpath java/bashcomp.jar ") + def test_3(self, completion, can_list_jar): + if can_list_jar: + assert completion == "bashcomp.jarred toplevel".split() + else: + assert not completion + + @pytest.mark.complete("java -cp java/bashcomp.jar:java/a/c ") + def test_4(self, completion, can_list_jar): + if can_list_jar: + assert completion == "bashcomp.jarred d toplevel".split() + else: + assert completion == ["d"] + + @pytest.mark.complete("java -cp '' ") + def test_5(self, completion): + assert not completion + + @pytest.mark.complete("java -jar java/") + def test_6(self, completion): + assert completion == "a/ bashcomp.jar bashcomp.war".split() -- cgit v1.2.3