mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
Improve assertions in func tests
This commit is contained in:
parent
992f488159
commit
bfa3c905a3
@ -1,3 +1,6 @@
|
|||||||
|
from pexpect import TIMEOUT
|
||||||
|
|
||||||
|
|
||||||
def with_confirmation(proc):
|
def with_confirmation(proc):
|
||||||
"""Ensures that command can be fixed when confirmation enabled."""
|
"""Ensures that command can be fixed when confirmation enabled."""
|
||||||
proc.sendline(u'mkdir -p ~/.thefuck')
|
proc.sendline(u'mkdir -p ~/.thefuck')
|
||||||
@ -6,12 +9,12 @@ def with_confirmation(proc):
|
|||||||
proc.sendline(u'ehco test')
|
proc.sendline(u'ehco test')
|
||||||
|
|
||||||
proc.sendline(u'fuck')
|
proc.sendline(u'fuck')
|
||||||
proc.expect(u'echo test')
|
assert proc.expect([TIMEOUT, u'echo test'])
|
||||||
proc.expect(u'enter')
|
assert proc.expect([TIMEOUT, u'enter'])
|
||||||
proc.expect_exact(u'ctrl+c')
|
assert proc.expect_exact([TIMEOUT, u'ctrl+c'])
|
||||||
proc.send('\n')
|
proc.send('\n')
|
||||||
|
|
||||||
proc.expect(u'test')
|
assert proc.expect([TIMEOUT, u'test'])
|
||||||
|
|
||||||
|
|
||||||
def refuse_with_confirmation(proc):
|
def refuse_with_confirmation(proc):
|
||||||
@ -22,12 +25,12 @@ def refuse_with_confirmation(proc):
|
|||||||
proc.sendline(u'ehco test')
|
proc.sendline(u'ehco test')
|
||||||
|
|
||||||
proc.sendline(u'fuck')
|
proc.sendline(u'fuck')
|
||||||
proc.expect(u'echo test')
|
assert proc.expect([TIMEOUT, u'echo test'])
|
||||||
proc.expect(u'enter')
|
assert proc.expect([TIMEOUT, u'enter'])
|
||||||
proc.expect_exact(u'ctrl+c')
|
assert proc.expect_exact([TIMEOUT, u'ctrl+c'])
|
||||||
proc.send('\003')
|
proc.send('\003')
|
||||||
|
|
||||||
proc.expect(u'Aborted')
|
assert proc.expect([TIMEOUT, u'Aborted'])
|
||||||
|
|
||||||
|
|
||||||
def without_confirmation(proc):
|
def without_confirmation(proc):
|
||||||
@ -38,5 +41,5 @@ def without_confirmation(proc):
|
|||||||
proc.sendline(u'ehco test')
|
proc.sendline(u'ehco test')
|
||||||
|
|
||||||
proc.sendline(u'fuck')
|
proc.sendline(u'fuck')
|
||||||
proc.expect(u'echo test')
|
assert proc.expect([TIMEOUT, u'echo test'])
|
||||||
proc.expect(u'test')
|
assert proc.expect([TIMEOUT, u'test'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user