1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/rules/test_git_two_dashes.py

46 lines
1.5 KiB
Python
Raw Normal View History

2015-10-17 21:35:39 +01:00
import pytest
from thefuck.rules.git_two_dashes import match, get_new_command
from thefuck.types import Command
2015-10-17 21:35:39 +01:00
output = 'error: did you mean `{}` (with two dashes ?)'.format
2015-10-17 21:35:39 +01:00
@pytest.mark.parametrize('command', [
Command('git add -patch', output('--patch')),
Command('git checkout -patch', output('--patch')),
Command('git commit -amend', output('--amend')),
Command('git push -tags', output('--tags')),
Command('git rebase -continue', output('--continue'))])
2015-10-17 21:35:39 +01:00
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('git add --patch', ''),
Command('git checkout --patch', ''),
Command('git commit --amend', ''),
Command('git push --tags', ''),
Command('git rebase --continue', '')])
2015-10-17 21:35:39 +01:00
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, output', [
(Command('git add -patch', output('--patch')),
2015-10-17 21:35:39 +01:00
'git add --patch'),
(Command('git checkout -patch', output('--patch')),
2015-10-17 21:35:39 +01:00
'git checkout --patch'),
(Command('git checkout -patch', output('--patch')),
2015-10-17 21:35:39 +01:00
'git checkout --patch'),
(Command('git init -bare', output('--bare')),
2015-10-17 21:35:39 +01:00
'git init --bare'),
(Command('git commit -amend', output('--amend')),
2015-10-17 21:35:39 +01:00
'git commit --amend'),
(Command('git push -tags', output('--tags')),
2015-10-17 21:35:39 +01:00
'git push --tags'),
(Command('git rebase -continue', output('--continue')),
2015-10-17 21:35:39 +01:00
'git rebase --continue')])
def test_get_new_command(command, output):
assert get_new_command(command) == output