diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:24:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:24:27 +0000 |
commit | 6c18848a903eb3ee06dccd915859ce64195c257c (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /test/t/unit/test_unit_find_unique_completion_pair.py | |
parent | Initial commit. (diff) | |
download | bash-completion-6c18848a903eb3ee06dccd915859ce64195c257c.tar.xz bash-completion-6c18848a903eb3ee06dccd915859ce64195c257c.zip |
Adding upstream version 1:2.11.upstream/1%2.11
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/t/unit/test_unit_find_unique_completion_pair.py')
-rw-r--r-- | test/t/unit/test_unit_find_unique_completion_pair.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/t/unit/test_unit_find_unique_completion_pair.py b/test/t/unit/test_unit_find_unique_completion_pair.py new file mode 100644 index 0000000..25cf9d3 --- /dev/null +++ b/test/t/unit/test_unit_find_unique_completion_pair.py @@ -0,0 +1,55 @@ +import pytest + +from conftest import find_unique_completion_pair + + +@pytest.mark.bashcomp(cmd=None) +class TestUnitFindUniqueCompletionPair: + def _test(self, inp: str, exp: str) -> None: + res = find_unique_completion_pair(inp.split()) + if exp: + part, cont = exp.split() + assert res == (part, part + cont) + else: + assert not exp + + def test_1(self): + self._test("a", "") + + def test_2(self): + self._test("ab", "a b") + + def test_3(self): + self._test("ab ab ab", "a b") + + def test_4(self): + self._test("a ab abcd abc", "") + + def test_5(self): + self._test("user1 user2", "") + + def test_6(self): + self._test("root username1 username2", "ro ot") + + def test_7(self): + self._test("root username21 username2", "ro ot") + + def test_8(self): + self._test( + "long_user_name lang_user_name long_usor_name", "lang_us er_name" + ) + + def test_9(self): + self._test( + "lang_user_name1 long_user_name lang_user_name long_usor_name", + "long_use r_name", + ) + + def test_10(self): + self._test("root username", "user name") + + def test_11(self): + self._test("a aladin", "ala din") + + def test_12(self): + self._test("ala aladin", "alad in") |