mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 12:06:04 +00:00
#1248: Check for multiple patterns in functional tests
This commit is contained in:
parent
ef1ea4b4dd
commit
cf0921be4a
@ -20,10 +20,12 @@ def with_confirmation(proc, TIMEOUT):
|
||||
assert proc.expect([TIMEOUT, u'test'])
|
||||
|
||||
|
||||
def history_changed(proc, TIMEOUT, to):
|
||||
def history_changed(proc, TIMEOUT, *to):
|
||||
"""Ensures that history changed."""
|
||||
proc.send('\033[A')
|
||||
assert proc.expect([TIMEOUT, to])
|
||||
pattern = [TIMEOUT]
|
||||
pattern.extend(to)
|
||||
assert proc.expect(pattern)
|
||||
|
||||
|
||||
def history_not_changed(proc, TIMEOUT):
|
||||
@ -44,14 +46,14 @@ def select_command_with_arrows(proc, TIMEOUT):
|
||||
proc.send('\033[B')
|
||||
assert proc.expect([TIMEOUT, u'git push'])
|
||||
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')
|
||||
assert proc.expect([TIMEOUT, u'git push'])
|
||||
proc.send('\033[B')
|
||||
assert proc.expect([TIMEOUT, u'git help'])
|
||||
assert proc.expect([TIMEOUT, u'git help', u'git hook'])
|
||||
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):
|
||||
|
@ -45,7 +45,7 @@ def test_with_confirmation(proc, TIMEOUT):
|
||||
@pytest.mark.functional
|
||||
def test_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
|
||||
|
@ -43,7 +43,7 @@ def test_with_confirmation(proc, TIMEOUT):
|
||||
@pytest.mark.functional
|
||||
def test_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
|
||||
|
Loading…
Reference in New Issue
Block a user