summaryrefslogtreecommitdiffstats
path: root/test/t/unit/test_unit_compgen_available_interfaces.py
blob: 5e931006c6d56672812110aa83d526c3e414d2b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest

from conftest import assert_bash_exec


@pytest.mark.bashcomp(cmd=None)
class TestUtilCompgenAvailableInterfaces:
    @pytest.fixture
    def functions(self, bash):
        assert_bash_exec(
            bash,
            "_comp__test_dump() { ((${#arr[@]})) && printf '<%s>' \"${arr[@]}\"; echo; }",
        )
        assert_bash_exec(
            bash,
            '_comp__test_compgen() { local -a arr=(00); _comp_compgen -v arr "$@"; _comp__test_dump; }',
        )

    def test_1_trailing_colons(self, bash, functions):
        output = assert_bash_exec(
            bash,
            "_comp__test_compgen available_interfaces",
            want_output=True,
        )
        assert ":" not in output.strip()