mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-28 08:02:33 +01:00
#682: Unify work with output in classic and instant mode
This commit is contained in:
@@ -1,47 +1,45 @@
|
||||
import pytest
|
||||
from thefuck.rules.git_two_dashes import match, get_new_command
|
||||
from tests.utils import Command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def stderr(meant):
|
||||
return 'error: did you mean `%s` (with two dashes ?)' % meant
|
||||
output = 'error: did you mean `{}` (with two dashes ?)'.format
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command(script='git add -patch', stderr=stderr('--patch')),
|
||||
Command(script='git checkout -patch', stderr=stderr('--patch')),
|
||||
Command(script='git commit -amend', stderr=stderr('--amend')),
|
||||
Command(script='git push -tags', stderr=stderr('--tags')),
|
||||
Command(script='git rebase -continue', stderr=stderr('--continue'))])
|
||||
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'))])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command(script='git add --patch'),
|
||||
Command(script='git checkout --patch'),
|
||||
Command(script='git commit --amend'),
|
||||
Command(script='git push --tags'),
|
||||
Command(script='git rebase --continue')])
|
||||
Command('git add --patch', ''),
|
||||
Command('git checkout --patch', ''),
|
||||
Command('git commit --amend', ''),
|
||||
Command('git push --tags', ''),
|
||||
Command('git rebase --continue', '')])
|
||||
def test_not_match(command):
|
||||
assert not match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, output', [
|
||||
(Command(script='git add -patch', stderr=stderr('--patch')),
|
||||
(Command('git add -patch', output('--patch')),
|
||||
'git add --patch'),
|
||||
(Command(script='git checkout -patch', stderr=stderr('--patch')),
|
||||
(Command('git checkout -patch', output('--patch')),
|
||||
'git checkout --patch'),
|
||||
(Command(script='git checkout -patch', stderr=stderr('--patch')),
|
||||
(Command('git checkout -patch', output('--patch')),
|
||||
'git checkout --patch'),
|
||||
(Command(script='git init -bare', stderr=stderr('--bare')),
|
||||
(Command('git init -bare', output('--bare')),
|
||||
'git init --bare'),
|
||||
(Command(script='git commit -amend', stderr=stderr('--amend')),
|
||||
(Command('git commit -amend', output('--amend')),
|
||||
'git commit --amend'),
|
||||
(Command(script='git push -tags', stderr=stderr('--tags')),
|
||||
(Command('git push -tags', output('--tags')),
|
||||
'git push --tags'),
|
||||
(Command(script='git rebase -continue', stderr=stderr('--continue')),
|
||||
(Command('git rebase -continue', output('--continue')),
|
||||
'git rebase --continue')])
|
||||
def test_get_new_command(command, output):
|
||||
assert get_new_command(command) == output
|
||||
|
Reference in New Issue
Block a user