diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
commit | 95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /test/t/unit/test_unit_get_cword.py | |
parent | 019f3cc463db63abc6460f97deb488deec43840b (diff) | |
download | bash-completion-upstream.tar.gz |
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'test/t/unit/test_unit_get_cword.py')
-rw-r--r-- | test/t/unit/test_unit_get_cword.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/test/t/unit/test_unit_get_cword.py b/test/t/unit/test_unit_get_cword.py index 3042dd29..0b56d163 100644 --- a/test/t/unit/test_unit_get_cword.py +++ b/test/t/unit/test_unit_get_cword.py @@ -1,17 +1,22 @@ +import pexpect import pytest -from conftest import assert_bash_exec, TestUnitBase +from conftest import PS1, TestUnitBase, assert_bash_exec @pytest.mark.bashcomp( - cmd=None, ignore_env=r"^[+-]COMP_(WORDS|CWORD|LINE|POINT)=" + cmd=None, ignore_env=r"^[+-](COMP_(WORDS|CWORD|LINE|POINT)|_scp_path_esc)=" ) class TestUnitGetCword(TestUnitBase): def _test(self, *args, **kwargs): return self._test_unit("_get_cword %s; echo", *args, **kwargs) def test_1(self, bash): - assert_bash_exec(bash, "_get_cword >/dev/null") + assert_bash_exec( + bash, + "COMP_WORDS=() COMP_CWORD= COMP_LINE= COMP_POINT= " + "_get_cword >/dev/null", + ) def test_2(self, bash): """a b| should return b""" @@ -133,3 +138,17 @@ class TestUnitGetCword(TestUnitBase): """a 'b&c| should return 'b&c""" output = self._test(bash, '(a "\'b&c")', 1, "a 'b&c", 6) assert output == "'b&c" + + @pytest.mark.xfail(reason="TODO: non-ASCII issues with test suite?") + def test_24(self, bash): + """Index shouldn't drop below 0""" + bash.send("scp ääää§ se\t\r\n") + got = bash.expect_exact( + [ + "index: substring expression < 0", + PS1, + pexpect.EOF, + pexpect.TIMEOUT, + ] + ) + assert got == 1 |