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

31 lines
861 B
Python
Raw Normal View History

import pytest
from thefuck.rules.missing_space_before_subcommand import (
match, get_new_command)
from tests.utils import Command
@pytest.fixture(autouse=True)
def all_executables(mocker):
return mocker.patch(
'thefuck.rules.missing_space_before_subcommand.get_all_executables',
return_value=['git', 'ls', 'npm'])
@pytest.mark.parametrize('script', [
'gitbranch', 'ls-la', 'npminstall'])
def test_match(script):
assert match(Command(script))
2017-04-10 22:23:23 +01:00
@pytest.mark.parametrize('script', ['git branch', 'vimfile'])
def test_not_match(script):
assert not match(Command(script))
@pytest.mark.parametrize('script, result', [
('gitbranch', 'git branch'),
('ls-la', 'ls -la'),
('npminstall webpack', 'npm install webpack')])
def test_get_new_command(script, result):
assert get_new_command(Command(script)) == result