mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
refact(man): do not match if there's no argument to man
If there's no argument to man, a call to thefuck should just give no fuck. Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
This commit is contained in:
parent
d088dac0f4
commit
6cf430cc23
@ -2,6 +2,7 @@ import pytest
|
||||
from thefuck.rules.man import match, get_new_command
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('man read'),
|
||||
Command('man 2 read'),
|
||||
@ -14,6 +15,13 @@ def test_match(command):
|
||||
assert match(command, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('man'),
|
||||
Command('man ')])
|
||||
def test_not_match(command):
|
||||
assert not match(command, None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('man read'), 'man 3 read'),
|
||||
(Command('man 2 read'), 'man 3 read'),
|
||||
|
@ -1,5 +1,5 @@
|
||||
def match(command, settings):
|
||||
return command.script.startswith('man')
|
||||
return command.script.strip().startswith('man ')
|
||||
|
||||
|
||||
def get_new_command(command, settings):
|
||||
|
Loading…
x
Reference in New Issue
Block a user