1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-07 20:34:02 +01:00

Added a rule to delete sudo for pacaur. (#787)

This commit is contained in:
JunYoung Gwak
2018-02-22 13:14:02 -08:00
committed by Vladimir Iakovlev
parent b65e3a9aad
commit dd9554539f
3 changed files with 39 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
import pytest
from thefuck.rules.unsudo import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('output', [
'you cannot perform this operation as root'])
def test_match(output):
assert match(Command('sudo ls', output))
def test_not_match():
assert not match(Command('', ''))
assert not match(Command('sudo ls', 'Permission denied'))
assert not match(Command('ls', 'you cannot perform this operation as root'))
@pytest.mark.parametrize('before, after', [
('sudo ls', 'ls'),
('sudo pacaur -S helloworld', 'pacaur -S helloworld')])
def test_get_new_command(before, after):
assert get_new_command(Command(before, '')) == after