Skip to content

Commit

Permalink
test(_filedir): add tests for . and .. exclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Aug 11, 2024
1 parent 7b4c531 commit f11c887
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/t/unit/test_unit_compgen_filedir.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,27 @@ def test_26(self, bash, functions, funcname):
def test_27(self, bash, functions, funcname, utf8_ctype):
completion = assert_complete(bash, "%s aé/" % funcname, cwd="_filedir")
assert completion == "g"

@pytest.mark.parametrize("funcname", "f f2".split())
def test_28_dot_1(self, bash, functions, funcname):
"""Exclude . and .. when the completion is attempted for '.[TAB]'"""
completion = assert_complete(bash, r"%s ." % funcname, cwd="_filedir")
assert completion == [".dotfile1", ".dotfile2"]

@pytest.mark.parametrize("funcname", "f f2".split())
def test_28_dot_2(self, bash, functions, funcname):
"""Exclude . and .. when the completion is attempted for 'dir/.[TAB]'"""
completion = assert_complete(bash, r"%s _filedir/." % funcname)
assert completion == [".dotfile1", ".dotfile2"]

@pytest.mark.parametrize("funcname", "f f2".split())
def test_28_dot_3(self, bash, functions, funcname):
"""Include . when the completion is attempted for '..[TAB]'"""
completion = assert_complete(bash, r"%s .." % funcname, cwd="_filedir")
assert completion == "/"

@pytest.mark.parametrize("funcname", "f f2".split())
def test_28_dot_4(self, bash, functions, funcname):
"""Include . when the completion is attempted for '..[TAB]'"""
completion = assert_complete(bash, r"%s _filedir/.." % funcname)
assert completion == "/"

0 comments on commit f11c887

Please sign in to comment.