Skip to content

Commit c180da0

Browse files
committed
test(java): test _comp_cmd_java__packages for varleak
1 parent e1b22b8 commit c180da0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/t/test_java.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from conftest import is_bash_type
3+
from conftest import is_bash_type, assert_bash_exec, bash_env_saved
44

55

66
@pytest.mark.bashcomp(
@@ -76,3 +76,12 @@ def test_packages_3(self, completion):
7676
@pytest.mark.complete("javadoc -sourcepath java/a ", env=dict(IFS="a"))
7777
def test_packages_4(self, completion):
7878
assert completion == "c"
79+
80+
def test_packages_5(self, bash):
81+
"""_comp_cmd_java__packages should not modify the outerscope `cur`"""
82+
with bash_env_saved(bash) as bash_env:
83+
bash_env.write_variable("cur", "a.b.c")
84+
assert_bash_exec(
85+
bash,
86+
"_comp_test_f() { local cword=3 words=(javadoc -sourcepath java/a a.b.c); COMPREPLY+=(); _comp_cmd_java__packages; }; _comp_test_f",
87+
)

0 commit comments

Comments
 (0)