1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-08 04:44:00 +01:00

Add git merge rule (#755)

This fixes https://github.com/nvbn/thefuck/issues/629
This commit is contained in:
David Hart
2018-01-02 16:47:48 +00:00
committed by Joseph Frazier
parent 897572d278
commit f700b23f57
3 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import pytest
from thefuck.rules.git_merge import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return 'merge: local - not something we can merge\n\n' \
'Did you mean this?\n\tremote/local'
def test_match(output):
assert match(Command('git merge test', output))
assert not match(Command('git merge master', ''))
assert not match(Command('ls', output))
@pytest.mark.parametrize('command, new_command', [
(Command('git merge local', output()),
'git merge remote/local'),
(Command('git merge -m "test" local', output()),
'git merge -m "test" remote/local'),
(Command('git merge -m "test local" local', output()),
'git merge -m "test local" remote/local')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command