Skip to content

Commit

Permalink
tests: test for file tab completion in open_test
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanePrawn committed Oct 4, 2023
1 parent c6f9ad0 commit 3d5d498
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/features/open_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ def test_open(run, tmpdir):

h.press('^X')
h.await_text('hello world')
h.press('^X')
h.await_exit()


def test_file_glob(run, tmpdir):
base = 'globtest'
prefix = base + 'ffff.txt'
f = tmpdir.join(prefix + 'f')
f.write('hello world')
g = tmpdir.join(base + 'fggg')
g.write('goodbye world')
nonexistant = str(tmpdir.join('NONEXISTANT'))

with run(str(g)) as h:
h.await_text('goodbye world')

h.press('^P')
h.press(nonexistant)
h.press('Tab')
h.await_text(f'«{nonexistant[-7:]}')
h.press('^C')
h.await_text('cancelled')
h.press('^P')
h.press(str(tmpdir.join(base + 'fff')))
h.press('Tab')
h.await_text(str(f)[-7:])
h.press('Tab') # second tab shouldn't change anything
h.await_text(str(f)[-7:])
h.press('Enter')
h.await_text('[2/2]')
h.await_text('hello world')
h.press('^X')
h.press('^X')
h.await_exit()

0 comments on commit 3d5d498

Please sign in to comment.