1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-29 00:22:32 +01:00

#682: Unify work with output in classic and instant mode

This commit is contained in:
Vladimir Iakovlev
2017-08-31 17:58:56 +02:00
parent 96843fc6cd
commit 4625d8503d
237 changed files with 1322 additions and 1332 deletions

View File

@@ -1,32 +1,32 @@
import pytest
from tests.utils import Command
from thefuck.types import Command
from thefuck.rules.yarn_command_replaced import match, get_new_command
stderr = ('error `install` has been replaced with `add` to add new '
output = ('error `install` has been replaced with `add` to add new '
'dependencies. Run "yarn add {}" instead.').format
@pytest.mark.parametrize('command', [
Command(script='yarn install redux', stderr=stderr('redux')),
Command(script='yarn install moment', stderr=stderr('moment')),
Command(script='yarn install lodash', stderr=stderr('lodash'))])
Command('yarn install redux', output('redux')),
Command('yarn install moment', output('moment')),
Command('yarn install lodash', output('lodash'))])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', [
Command('yarn install')])
Command('yarn install', '')])
def test_not_match(command):
assert not match(command)
@pytest.mark.parametrize('command, new_command', [
(Command('yarn install redux', stderr=stderr('redux')),
(Command('yarn install redux', output('redux')),
'yarn add redux'),
(Command('yarn install moment', stderr=stderr('moment')),
(Command('yarn install moment', output('moment')),
'yarn add moment'),
(Command('yarn install lodash', stderr=stderr('lodash')),
(Command('yarn install lodash', output('lodash')),
'yarn add lodash')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command