summaryrefslogtreecommitdiffstats
path: root/test/t/unit/test_unit_compgen_available_interfaces.py
blob: f3ebac01cfbda4a82248a108480afe3e56bf5ddf (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()