1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/rules/test_git_merge_unrelated.py
2018-11-21 19:43:01 +01:00

24 lines
832 B
Python

import pytest
from thefuck.rules.git_merge_unrelated import match, get_new_command
from thefuck.types import Command
output = 'fatal: refusing to merge unrelated histories'
def test_match():
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 local --allow-unrelated-histories'),
(Command('git merge -m "test" local', output),
'git merge -m "test" local --allow-unrelated-histories'),
(Command('git merge -m "test local" local', output),
'git merge -m "test local" local --allow-unrelated-histories')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command