mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 10:11:14 +00:00
#N/A Add tests for "ctrl+c"
This commit is contained in:
parent
174ada054d
commit
9ab4491b96
@ -11,6 +11,19 @@ def with_confirmation(proc):
|
|||||||
proc.expect('test')
|
proc.expect('test')
|
||||||
|
|
||||||
|
|
||||||
|
def refuse_with_confirmation(proc):
|
||||||
|
"""Ensures that fix can be refused when confirmation enabled."""
|
||||||
|
proc.sendline('ehco test')
|
||||||
|
|
||||||
|
proc.sendline('fuck')
|
||||||
|
proc.expect('echo test')
|
||||||
|
proc.expect('enter')
|
||||||
|
proc.expect_exact('ctrl+c')
|
||||||
|
proc.send('\003')
|
||||||
|
|
||||||
|
proc.expect('Aborted')
|
||||||
|
|
||||||
|
|
||||||
def without_confirmation(proc):
|
def without_confirmation(proc):
|
||||||
"""Ensures that command can be fixed when confirmation disabled."""
|
"""Ensures that command can be fixed when confirmation disabled."""
|
||||||
proc.sendline('ehco test')
|
proc.sendline('ehco test')
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from tests.functional.plots import with_confirmation, without_confirmation
|
from tests.functional.plots import with_confirmation, without_confirmation,\
|
||||||
|
refuse_with_confirmation
|
||||||
from tests.functional.utils import spawn, functional
|
from tests.functional.utils import spawn, functional
|
||||||
|
|
||||||
containers = [('ubuntu-python3-bash', '''
|
containers = [('ubuntu-python3-bash', '''
|
||||||
@ -27,6 +28,14 @@ def test_with_confirmation(tag, dockerfile):
|
|||||||
with_confirmation(proc)
|
with_confirmation(proc)
|
||||||
|
|
||||||
|
|
||||||
|
@functional
|
||||||
|
@pytest.mark.parametrize('tag, dockerfile', containers)
|
||||||
|
def test_refuse_with_confirmation(tag, dockerfile):
|
||||||
|
with spawn(tag, dockerfile) as proc:
|
||||||
|
proc.sendline('eval $(thefuck-alias)')
|
||||||
|
refuse_with_confirmation(proc)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@functional
|
||||||
@pytest.mark.parametrize('tag, dockerfile', containers)
|
@pytest.mark.parametrize('tag, dockerfile', containers)
|
||||||
def test_without_confirmation(tag, dockerfile):
|
def test_without_confirmation(tag, dockerfile):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from tests.functional.plots import with_confirmation, without_confirmation
|
from tests.functional.plots import with_confirmation, without_confirmation, \
|
||||||
|
refuse_with_confirmation
|
||||||
from tests.functional.utils import spawn, functional
|
from tests.functional.utils import spawn, functional
|
||||||
|
|
||||||
containers = [('ubuntu-python3-bash', '''
|
containers = [('ubuntu-python3-bash', '''
|
||||||
@ -28,6 +29,15 @@ def test_with_confirmation(tag, dockerfile):
|
|||||||
with_confirmation(proc)
|
with_confirmation(proc)
|
||||||
|
|
||||||
|
|
||||||
|
@functional
|
||||||
|
@pytest.mark.parametrize('tag, dockerfile', containers)
|
||||||
|
def test_refuse_with_confirmation(tag, dockerfile):
|
||||||
|
with spawn(tag, dockerfile) as proc:
|
||||||
|
proc.sendline('thefuck-alias >> ~/.config/fish/config.fish')
|
||||||
|
proc.sendline('fish')
|
||||||
|
refuse_with_confirmation(proc)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@functional
|
||||||
@pytest.mark.parametrize('tag, dockerfile', containers)
|
@pytest.mark.parametrize('tag, dockerfile', containers)
|
||||||
def test_without_confirmation(tag, dockerfile):
|
def test_without_confirmation(tag, dockerfile):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from tests.functional.utils import spawn, functional
|
from tests.functional.utils import spawn, functional
|
||||||
from tests.functional.plots import with_confirmation, without_confirmation
|
from tests.functional.plots import with_confirmation, without_confirmation,\
|
||||||
|
refuse_with_confirmation
|
||||||
|
|
||||||
containers = [('ubuntu-python3-zsh', '''
|
containers = [('ubuntu-python3-zsh', '''
|
||||||
FROM ubuntu:latest
|
FROM ubuntu:latest
|
||||||
@ -27,6 +28,14 @@ def test_with_confirmation(tag, dockerfile):
|
|||||||
with_confirmation(proc)
|
with_confirmation(proc)
|
||||||
|
|
||||||
|
|
||||||
|
@functional
|
||||||
|
@pytest.mark.parametrize('tag, dockerfile', containers)
|
||||||
|
def test_refuse_with_confirmation(tag, dockerfile):
|
||||||
|
with spawn(tag, dockerfile) as proc:
|
||||||
|
proc.sendline('eval $(thefuck-alias)')
|
||||||
|
refuse_with_confirmation(proc)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@functional
|
||||||
@pytest.mark.parametrize('tag, dockerfile', containers)
|
@pytest.mark.parametrize('tag, dockerfile', containers)
|
||||||
def test_without_confirmation(tag, dockerfile):
|
def test_without_confirmation(tag, dockerfile):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user