summaryrefslogtreecommitdiff
path: root/test/t/unit/test_unit_expand.py
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-08-03 18:43:13 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-08-03 18:43:13 -0300
commit95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch)
treeea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /test/t/unit/test_unit_expand.py
parent019f3cc463db63abc6460f97deb488deec43840b (diff)
downloadbash-completion-95623d39d6029ba78ec96ad5ea08e9ac12629b91.tar.gz
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'test/t/unit/test_unit_expand.py')
-rw-r--r--test/t/unit/test_unit_expand.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/t/unit/test_unit_expand.py b/test/t/unit/test_unit_expand.py
index 7c0a9836..d2a3ebc4 100644
--- a/test/t/unit/test_unit_expand.py
+++ b/test/t/unit/test_unit_expand.py
@@ -3,7 +3,7 @@ import pytest
from conftest import assert_bash_exec
-@pytest.mark.bashcomp(cmd=None)
+@pytest.mark.bashcomp(cmd=None, ignore_env=r"^[+-](cur|COMPREPLY)=")
class TestUnitExpand:
def test_1(self, bash):
assert_bash_exec(bash, "_expand >/dev/null")
@@ -11,3 +11,21 @@ class TestUnitExpand:
def test_2(self, bash):
"""Test environment non-pollution, detected at teardown."""
assert_bash_exec(bash, "foo() { _expand; }; foo; unset foo")
+
+ def test_user_home_compreply(self, bash, user_home):
+ user, home = user_home
+ output = assert_bash_exec(
+ bash,
+ r'cur="~%s"; _expand; printf "%%s\n" "$COMPREPLY"' % user,
+ want_output=True,
+ )
+ assert output.strip() == home
+
+ def test_user_home_cur(self, bash, user_home):
+ user, home = user_home
+ output = assert_bash_exec(
+ bash,
+ r'cur="~%s/a"; _expand; printf "%%s\n" "$cur"' % user,
+ want_output=True,
+ )
+ assert output.strip() == "%s/a" % home