mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-22 21:08:48 +00:00
#N/A: Make missing_space_before_subcommand
handle aliases correctly
This commit is contained in:
parent
ef3aabe7c5
commit
2788ef1471
@ -4,12 +4,6 @@ from thefuck.rules.missing_space_before_subcommand import (
|
|||||||
from tests.utils import Command
|
from tests.utils import Command
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def which(mocker):
|
|
||||||
return mocker.patch('thefuck.rules.missing_space_before_subcommand.which',
|
|
||||||
return_value=None)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def all_executables(mocker):
|
def all_executables(mocker):
|
||||||
return mocker.patch(
|
return mocker.patch(
|
||||||
@ -23,11 +17,8 @@ def test_match(script):
|
|||||||
assert match(Command(script))
|
assert match(Command(script))
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('script, which_result', [
|
@pytest.mark.parametrize('script', ['git branch' 'vimfile'])
|
||||||
('git branch', '/usr/bin/git'),
|
def test_not_match(script):
|
||||||
('vimfile', None)])
|
|
||||||
def test_not_match(script, which_result, which):
|
|
||||||
which.return_value = which_result
|
|
||||||
assert not match(Command(script))
|
assert not match(Command(script))
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ def _get_executable(script_part):
|
|||||||
|
|
||||||
|
|
||||||
def match(command):
|
def match(command):
|
||||||
return (not which(command.script_parts[0])
|
return (not command.script_parts[0] in get_all_executables()
|
||||||
and _get_executable(command.script_parts[0]))
|
and _get_executable(command.script_parts[0]))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user