1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

#1248: Check for multiple patterns in functional tests

This commit is contained in:
Pablo Santiago Blum de Aguiar 2023-07-10 14:39:58 +02:00
parent ef1ea4b4dd
commit cf0921be4a
3 changed files with 9 additions and 7 deletions

View File

@ -20,10 +20,12 @@ def with_confirmation(proc, TIMEOUT):
assert proc.expect([TIMEOUT, u'test']) assert proc.expect([TIMEOUT, u'test'])
def history_changed(proc, TIMEOUT, to): def history_changed(proc, TIMEOUT, *to):
"""Ensures that history changed.""" """Ensures that history changed."""
proc.send('\033[A') proc.send('\033[A')
assert proc.expect([TIMEOUT, to]) pattern = [TIMEOUT]
pattern.extend(to)
assert proc.expect(pattern)
def history_not_changed(proc, TIMEOUT): def history_not_changed(proc, TIMEOUT):
@ -44,14 +46,14 @@ def select_command_with_arrows(proc, TIMEOUT):
proc.send('\033[B') proc.send('\033[B')
assert proc.expect([TIMEOUT, u'git push']) assert proc.expect([TIMEOUT, u'git push'])
proc.send('\033[B') proc.send('\033[B')
assert proc.expect([TIMEOUT, u'git help']) assert proc.expect([TIMEOUT, u'git help', u'git hook'])
proc.send('\033[A') proc.send('\033[A')
assert proc.expect([TIMEOUT, u'git push']) assert proc.expect([TIMEOUT, u'git push'])
proc.send('\033[B') proc.send('\033[B')
assert proc.expect([TIMEOUT, u'git help']) assert proc.expect([TIMEOUT, u'git help', u'git hook'])
proc.send('\n') proc.send('\n')
assert proc.expect([TIMEOUT, u'usage']) assert proc.expect([TIMEOUT, u'usage', u'fatal: not a git repository'])
def refuse_with_confirmation(proc, TIMEOUT): def refuse_with_confirmation(proc, TIMEOUT):

View File

@ -45,7 +45,7 @@ def test_with_confirmation(proc, TIMEOUT):
@pytest.mark.functional @pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT): def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT) select_command_with_arrows(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'git help') history_changed(proc, TIMEOUT, u'git help', u'git hook')
@pytest.mark.functional @pytest.mark.functional

View File

@ -43,7 +43,7 @@ def test_with_confirmation(proc, TIMEOUT):
@pytest.mark.functional @pytest.mark.functional
def test_select_command_with_arrows(proc, TIMEOUT): def test_select_command_with_arrows(proc, TIMEOUT):
select_command_with_arrows(proc, TIMEOUT) select_command_with_arrows(proc, TIMEOUT)
history_changed(proc, TIMEOUT, u'git help') history_changed(proc, TIMEOUT, u'git help', u'git hook')
@pytest.mark.functional @pytest.mark.functional