mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-30 06:34:09 +00:00
#682: Unify work with output in classic and instant mode
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
import pytest
|
||||
from thefuck.rules.yarn_alias import match, get_new_command
|
||||
from tests.utils import Command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
stderr_remove = 'error Did you mean `yarn remove`?'
|
||||
stderr_etl = 'error Command "etil" not found. Did you mean "etl"?'
|
||||
stderr_list = 'error Did you mean `yarn list`?'
|
||||
output_remove = 'error Did you mean `yarn remove`?'
|
||||
output_etl = 'error Command "etil" not found. Did you mean "etl"?'
|
||||
output_list = 'error Did you mean `yarn list`?'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command(script='yarn rm', stderr=stderr_remove),
|
||||
Command(script='yarn etil', stderr=stderr_etl),
|
||||
Command(script='yarn ls', stderr=stderr_list)])
|
||||
Command('yarn rm', output_remove),
|
||||
Command('yarn etil', output_etl),
|
||||
Command('yarn ls', output_list)])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('yarn rm', stderr=stderr_remove), 'yarn remove'),
|
||||
(Command('yarn etil', stderr=stderr_etl), 'yarn etl'),
|
||||
(Command('yarn ls', stderr=stderr_list), 'yarn list')])
|
||||
(Command('yarn rm', output_remove), 'yarn remove'),
|
||||
(Command('yarn etil', output_etl), 'yarn etl'),
|
||||
(Command('yarn ls', output_list), 'yarn list')])
|
||||
def test_get_new_command(command, new_command):
|
||||
assert get_new_command(command) == new_command
|
||||
|
||||
Reference in New Issue
Block a user