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

29 lines
755 B
Python
Raw Normal View History

2015-06-06 16:06:10 +01:00
import pytest
from thefuck.rules.cargo_no_command import match, get_new_command
from thefuck.types import Command
2015-06-06 16:06:10 +01:00
no_such_subcommand_old = """No such subcommand
2015-06-06 16:06:10 +01:00
Did you mean `build`?
"""
no_such_subcommand = """error: no such subcommand
\tDid you mean `build`?
"""
2015-06-06 16:06:10 +01:00
@pytest.mark.parametrize('command', [
Command('cargo buid', no_such_subcommand_old),
Command('cargo buils', no_such_subcommand)])
2015-06-06 16:06:10 +01:00
def test_match(command):
assert match(command)
2015-06-06 16:06:10 +01:00
@pytest.mark.parametrize('command, new_command', [
(Command('cargo buid', no_such_subcommand_old), 'cargo build'),
(Command('cargo buils', no_such_subcommand), 'cargo build')])
2015-06-06 16:06:10 +01:00
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command