mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 01:28:56 +00:00
Add more functional tests
This commit is contained in:
parent
59d0836b6f
commit
5d808b65f1
@ -83,3 +83,17 @@ def without_confirmation(proc, TIMEOUT):
|
|||||||
def how_to_configure(proc, TIMEOUT):
|
def how_to_configure(proc, TIMEOUT):
|
||||||
proc.sendline(u'fuck')
|
proc.sendline(u'fuck')
|
||||||
assert proc.expect([TIMEOUT, u"alias isn't configured"])
|
assert proc.expect([TIMEOUT, u"alias isn't configured"])
|
||||||
|
|
||||||
|
|
||||||
|
def status_success(proc, TIMEOUT):
|
||||||
|
proc.sendline(u'git commit --allow-empty -m "Test"')
|
||||||
|
|
||||||
|
proc.sendline(u'fuck')
|
||||||
|
assert proc.expect([TIMEOUT, u'git commit --amend'])
|
||||||
|
|
||||||
|
|
||||||
|
def status_failure(proc, TIMEOUT):
|
||||||
|
proc.sendline(u'git commit -m "Test"')
|
||||||
|
|
||||||
|
proc.sendline(u'fuck')
|
||||||
|
assert proc.expect([TIMEOUT, u'git reset HEAD~'])
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
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, history_changed, history_not_changed, \
|
refuse_with_confirmation, history_changed, history_not_changed, \
|
||||||
select_command_with_arrows, how_to_configure
|
select_command_with_arrows, how_to_configure, status_success, \
|
||||||
|
status_failure
|
||||||
|
|
||||||
|
|
||||||
python_3 = (u'thefuck/python3-bash',
|
python_3 = (u'thefuck/python3-bash',
|
||||||
@ -66,3 +67,13 @@ def test_without_confirmation(proc, TIMEOUT):
|
|||||||
def test_how_to_configure_alias(proc, TIMEOUT):
|
def test_how_to_configure_alias(proc, TIMEOUT):
|
||||||
proc.sendline('unset -f fuck')
|
proc.sendline('unset -f fuck')
|
||||||
how_to_configure(proc, TIMEOUT)
|
how_to_configure(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_success(proc, TIMEOUT):
|
||||||
|
status_success(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_failure(proc, TIMEOUT):
|
||||||
|
status_failure(proc, TIMEOUT)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
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, select_command_with_arrows
|
refuse_with_confirmation, select_command_with_arrows, status_success, \
|
||||||
|
status_failure
|
||||||
|
|
||||||
containers = (('thefuck/python3-fish',
|
containers = (('thefuck/python3-fish',
|
||||||
u'''FROM python:3
|
u'''FROM python:3
|
||||||
@ -49,4 +50,14 @@ def test_refuse_with_confirmation(proc, TIMEOUT):
|
|||||||
def test_without_confirmation(proc, TIMEOUT):
|
def test_without_confirmation(proc, TIMEOUT):
|
||||||
without_confirmation(proc, TIMEOUT)
|
without_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_success(proc, TIMEOUT):
|
||||||
|
status_success(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_failure(proc, TIMEOUT):
|
||||||
|
status_failure(proc, TIMEOUT)
|
||||||
|
|
||||||
# TODO: ensure that history changes.
|
# TODO: ensure that history changes.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
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, select_command_with_arrows
|
refuse_with_confirmation, select_command_with_arrows, status_success, \
|
||||||
|
status_failure
|
||||||
|
|
||||||
containers = (('thefuck/python3-tcsh',
|
containers = (('thefuck/python3-tcsh',
|
||||||
u'''FROM python:3
|
u'''FROM python:3
|
||||||
@ -44,4 +45,14 @@ def test_refuse_with_confirmation(proc, TIMEOUT):
|
|||||||
def test_without_confirmation(proc, TIMEOUT):
|
def test_without_confirmation(proc, TIMEOUT):
|
||||||
without_confirmation(proc, TIMEOUT)
|
without_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_success(proc, TIMEOUT):
|
||||||
|
status_success(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_failure(proc, TIMEOUT):
|
||||||
|
status_failure(proc, TIMEOUT)
|
||||||
|
|
||||||
# TODO: ensure that history changes.
|
# TODO: ensure that history changes.
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
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, history_changed, history_not_changed, \
|
refuse_with_confirmation, history_changed, history_not_changed, \
|
||||||
select_command_with_arrows, how_to_configure
|
select_command_with_arrows, how_to_configure, status_success, \
|
||||||
|
status_failure
|
||||||
|
|
||||||
|
|
||||||
python_3 = ('thefuck/python3-zsh',
|
python_3 = ('thefuck/python3-zsh',
|
||||||
@ -73,3 +74,13 @@ def test_without_confirmation(proc, TIMEOUT):
|
|||||||
def test_how_to_configure_alias(proc, TIMEOUT):
|
def test_how_to_configure_alias(proc, TIMEOUT):
|
||||||
proc.sendline(u'unfunction fuck')
|
proc.sendline(u'unfunction fuck')
|
||||||
how_to_configure(proc, TIMEOUT)
|
how_to_configure(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_success(proc, TIMEOUT):
|
||||||
|
status_success(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.functional
|
||||||
|
def test_status_failure(proc, TIMEOUT):
|
||||||
|
status_failure(proc, TIMEOUT)
|
||||||
|
@ -10,6 +10,7 @@ class Tcsh(Generic):
|
|||||||
|
|
||||||
def app_alias(self, alias_name):
|
def app_alias(self, alias_name):
|
||||||
return ("alias {0} 'setenv TF_SHELL tcsh && setenv TF_ALIAS {0} && "
|
return ("alias {0} 'setenv TF_SHELL tcsh && setenv TF_ALIAS {0} && "
|
||||||
|
"setenv TF_STATUS=$status && "
|
||||||
"set fucked_cmd=`history -h 2 | head -n 1` && "
|
"set fucked_cmd=`history -h 2 | head -n 1` && "
|
||||||
"eval `thefuck ${{fucked_cmd}}`'").format(alias_name)
|
"eval `thefuck ${{fucked_cmd}}`'").format(alias_name)
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ class Zsh(Generic):
|
|||||||
{name} () {{
|
{name} () {{
|
||||||
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
|
TF_PYTHONIOENCODING=$PYTHONIOENCODING;
|
||||||
export TF_SHELL=zsh;
|
export TF_SHELL=zsh;
|
||||||
|
export TF_STATUS=$?;
|
||||||
export TF_ALIAS={name};
|
export TF_ALIAS={name};
|
||||||
TF_SHELL_ALIASES=$(alias);
|
TF_SHELL_ALIASES=$(alias);
|
||||||
export TF_SHELL_ALIASES;
|
export TF_SHELL_ALIASES;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user