1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-21 20:38:54 +00:00

Merge branch 'master' of github.com:nvbn/thefuck

This commit is contained in:
nvbn 2015-07-21 16:19:11 +03:00
commit e0af35819d
4 changed files with 8 additions and 3 deletions

View File

@ -3,7 +3,9 @@ from thefuck.rules.git_diff_staged import match, get_new_command
from tests.utils import Command from tests.utils import Command
@pytest.mark.parametrize('command', [Command(script='git diff')]) @pytest.mark.parametrize('command', [
Command(script='git diff foo'),
Command(script='git diff')])
def test_match(command): def test_match(command):
assert match(command, None) assert match(command, None)
@ -18,6 +20,7 @@ def test_not_match(command):
@pytest.mark.parametrize('command, new_command', [ @pytest.mark.parametrize('command, new_command', [
(Command('git diff'), 'git diff --staged')]) (Command('git diff'), 'git diff --staged'),
(Command('git diff foo'), 'git diff --staged foo')])
def test_get_new_command(command, new_command): def test_get_new_command(command, new_command):
assert get_new_command(command, None) == new_command assert get_new_command(command, None) == new_command

View File

@ -11,6 +11,7 @@ from tests.utils import Command
('need to be root', ''), ('need to be root', ''),
('need root', ''), ('need root', ''),
('must be root', ''), ('must be root', ''),
('You don\'t have access to the history DB.', ''),
('', "error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ipaddr.py'")]) ('', "error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/ipaddr.py'")])
def test_match(stderr, stdout): def test_match(stderr, stdout):
assert match(Command(stderr=stderr, stdout=stdout), None) assert match(Command(stderr=stderr, stdout=stdout), None)

View File

@ -10,4 +10,4 @@ def match(command, settings):
@utils.git_support @utils.git_support
def get_new_command(command, settings): def get_new_command(command, settings):
return '{} --staged'.format(command.script) return command.script.replace(' diff', ' diff --staged')

View File

@ -14,6 +14,7 @@ patterns = ['permission denied',
'need to be root', 'need to be root',
'need root', 'need root',
'only root can do that', 'only root can do that',
'You don\'t have access to the history DB.',
'authentication is required'] 'authentication is required']