|
6 | 6 |
|
7 | 7 | import pytest
|
8 | 8 |
|
9 |
| -from conftest import assert_bash_exec, assert_complete |
| 9 | +from conftest import assert_bash_exec, assert_complete, bash_env_saved |
10 | 10 |
|
11 | 11 |
|
12 | 12 | @pytest.mark.bashcomp(cmd=None, ignore_env=r"^\+COMPREPLY=")
|
@@ -59,7 +59,9 @@ def utf8_ctype(self, bash):
|
59 | 59 | return lc_ctype
|
60 | 60 |
|
61 | 61 | def test_1(self, bash):
|
62 |
| - assert_bash_exec(bash, "_comp_compgen_filedir >/dev/null") |
| 62 | + with bash_env_saved(bash) as bash_env: |
| 63 | + bash_env.write_variable("cur", "") |
| 64 | + assert_bash_exec(bash, 'cur="" _comp_compgen_filedir >/dev/null') |
63 | 65 |
|
64 | 66 | @pytest.mark.parametrize("funcname", "f f2".split())
|
65 | 67 | def test_2(self, bash, functions, funcname):
|
@@ -233,3 +235,27 @@ def test_26(self, bash, functions, funcname):
|
233 | 235 | def test_27(self, bash, functions, funcname, utf8_ctype):
|
234 | 236 | completion = assert_complete(bash, "%s aé/" % funcname, cwd="_filedir")
|
235 | 237 | assert completion == "g"
|
| 238 | + |
| 239 | + @pytest.mark.parametrize("funcname", "f f2".split()) |
| 240 | + def test_28_dot_1(self, bash, functions, funcname): |
| 241 | + """Exclude . and .. when the completion is attempted for '.[TAB]'""" |
| 242 | + completion = assert_complete(bash, r"%s ." % funcname, cwd="_filedir") |
| 243 | + assert completion == [".dotfile1", ".dotfile2"] |
| 244 | + |
| 245 | + @pytest.mark.parametrize("funcname", "f f2".split()) |
| 246 | + def test_28_dot_2(self, bash, functions, funcname): |
| 247 | + """Exclude . and .. when the completion is attempted for 'dir/.[TAB]'""" |
| 248 | + completion = assert_complete(bash, r"%s _filedir/." % funcname) |
| 249 | + assert completion == [".dotfile1", ".dotfile2"] |
| 250 | + |
| 251 | + @pytest.mark.parametrize("funcname", "f f2".split()) |
| 252 | + def test_28_dot_3(self, bash, functions, funcname): |
| 253 | + """Include . when the completion is attempted for '..[TAB]'""" |
| 254 | + completion = assert_complete(bash, r"%s .." % funcname, cwd="_filedir") |
| 255 | + assert completion == "/" |
| 256 | + |
| 257 | + @pytest.mark.parametrize("funcname", "f f2".split()) |
| 258 | + def test_28_dot_4(self, bash, functions, funcname): |
| 259 | + """Include . when the completion is attempted for '..[TAB]'""" |
| 260 | + completion = assert_complete(bash, r"%s _filedir/.." % funcname) |
| 261 | + assert completion == "/" |
0 commit comments