1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 14:44:05 +00:00

Start support for git aliases

This commit is contained in:
mcarton
2015-07-16 20:23:31 +02:00
parent 78769e4fbc
commit b3e09d68df
4 changed files with 32 additions and 3 deletions

View File

@@ -84,7 +84,7 @@ class TestGetCommand(object):
shell=True,
stdout=PIPE,
stderr=PIPE,
env={'LANG': 'C'})
env={'LANG': 'C', 'GIT_TRACE': 1})
@pytest.mark.parametrize('args, result', [
(['thefuck', 'ls', '-la'], 'ls -la'),

View File

@@ -1,6 +1,6 @@
import pytest
from mock import Mock
from thefuck.utils import sudo_support, wrap_settings, memoize, get_closest
from thefuck.utils import git_support, sudo_support, wrap_settings, memoize, get_closest
from thefuck.types import Settings
from tests.utils import Command
@@ -26,6 +26,15 @@ def test_sudo_support(return_value, command, called, result):
fn.assert_called_once_with(Command(called), None)
@pytest.mark.parametrize('called, command, stderr', [
('git co', "git 'checkout'", "19:22:36.299340 git.c:282 trace: alias expansion: co => 'checkout'"),
('git com file', "git 'commit' '--verbose' file", "19:23:25.470911 git.c:282 trace: alias expansion: com => 'commit' '--verbose'")])
def test_git_support(called, command, stderr):
@git_support
def fn(command, settings): return command.script
assert fn(Command(script=called, stderr=stderr), None) == command
def test_memoize():
fn = Mock(__name__='fn')
memoized = memoize(fn)