|
| 1 | +import pytest |
| 2 | + |
| 3 | +from conftest import assert_bash_exec |
| 4 | + |
| 5 | + |
| 6 | +@pytest.mark.bashcomp(cmd=None) |
| 7 | +class TestUnitDelimited: |
| 8 | + @pytest.fixture(scope="class") |
| 9 | + def functions(self, request, bash): |
| 10 | + assert_bash_exec( |
| 11 | + bash, |
| 12 | + "_comp_cmd_test_delim() {" |
| 13 | + " local cur prev words cword comp_args;" |
| 14 | + " _comp_get_words cur;" |
| 15 | + " _comp_delimited , -W 'alpha beta bravo';" |
| 16 | + "};" |
| 17 | + "complete -F _comp_cmd_test_delim test_delim", |
| 18 | + ) |
| 19 | + |
| 20 | + @pytest.mark.complete("test_delim --opt=a") |
| 21 | + def test_1(self, functions, completion): |
| 22 | + assert completion == ["lpha"] |
| 23 | + |
| 24 | + @pytest.mark.complete("test_delim --opt=b") |
| 25 | + def test_2(self, functions, completion): |
| 26 | + assert completion == ["beta", "bravo"] |
| 27 | + |
| 28 | + @pytest.mark.complete("test_delim --opt=alpha,b") |
| 29 | + def test_3(self, functions, completion): |
| 30 | + assert completion == ["alpha,beta", "alpha,bravo"] |
| 31 | + |
| 32 | + @pytest.mark.complete("test_delim --opt=alpha,be") |
| 33 | + def test_4(self, functions, completion): |
| 34 | + assert completion == ["ta"] |
| 35 | + |
| 36 | + @pytest.mark.complete("test_delim --opt=beta,a") |
| 37 | + def test_5(self, functions, completion): |
| 38 | + assert completion == ["lpha"] |
| 39 | + |
| 40 | + @pytest.mark.complete("test_delim --opt=c") |
| 41 | + def test_6(self, functions, completion): |
| 42 | + assert not completion |
0 commit comments