diff --git a/tests/rules/test_missing_space_before_subcommand.py b/tests/rules/test_missing_space_before_subcommand.py index 7455b9e..53b6009 100644 --- a/tests/rules/test_missing_space_before_subcommand.py +++ b/tests/rules/test_missing_space_before_subcommand.py @@ -8,11 +8,11 @@ from thefuck.types import Command def all_executables(mocker): return mocker.patch( 'thefuck.rules.missing_space_before_subcommand.get_all_executables', - return_value=['git', 'ls', 'npm']) + return_value=['git', 'ls', 'npm', 'w', 'watch']) @pytest.mark.parametrize('script', [ - 'gitbranch', 'ls-la', 'npminstall']) + 'gitbranch', 'ls-la', 'npminstall', 'watchls']) def test_match(script): assert match(Command(script, '')) @@ -25,6 +25,7 @@ def test_not_match(script): @pytest.mark.parametrize('script, result', [ ('gitbranch', 'git branch'), ('ls-la', 'ls -la'), - ('npminstall webpack', 'npm install webpack')]) + ('npminstall webpack', 'npm install webpack'), + ('watchls', 'watch ls')]) def test_get_new_command(script, result): assert get_new_command(Command(script, '')) == result diff --git a/thefuck/rules/missing_space_before_subcommand.py b/thefuck/rules/missing_space_before_subcommand.py index 410cb4b..fd4fbd7 100644 --- a/thefuck/rules/missing_space_before_subcommand.py +++ b/thefuck/rules/missing_space_before_subcommand.py @@ -4,7 +4,7 @@ from thefuck.utils import get_all_executables, memoize @memoize def _get_executable(script_part): for executable in get_all_executables(): - if script_part.startswith(executable): + if len(executable) > 1 and script_part.startswith(executable): return executable