mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 04:18:55 +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
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def which(mocker):
|
||||
return mocker.patch('thefuck.rules.missing_space_before_subcommand.which',
|
||||
return_value=None)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def all_executables(mocker):
|
||||
return mocker.patch(
|
||||
@ -23,11 +17,8 @@ def test_match(script):
|
||||
assert match(Command(script))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, which_result', [
|
||||
('git branch', '/usr/bin/git'),
|
||||
('vimfile', None)])
|
||||
def test_not_match(script, which_result, which):
|
||||
which.return_value = which_result
|
||||
@pytest.mark.parametrize('script', ['git branch' 'vimfile'])
|
||||
def test_not_match(script):
|
||||
assert not match(Command(script))
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ def _get_executable(script_part):
|
||||
|
||||
|
||||
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]))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user