2015-04-25 02:54:39 +02:00
|
|
|
import pytest
|
2015-04-20 12:32:32 +02:00
|
|
|
from thefuck.rules.rm_dir import match, get_new_command
|
2015-04-25 02:35:26 +02:00
|
|
|
from tests.utils import Command
|
2015-04-20 12:32:32 +02:00
|
|
|
|
|
|
|
|
2015-04-25 02:54:39 +02:00
|
|
|
@pytest.mark.parametrize('command', [
|
|
|
|
Command('rm foo', stderr='rm: foo: is a directory'),
|
|
|
|
Command('rm foo', stderr='rm: foo: Is a directory')])
|
|
|
|
def test_match(command):
|
|
|
|
assert match(command, None)
|
|
|
|
assert match(command, None)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
|
|
Command('rm foo'), Command('rm foo'), Command()])
|
|
|
|
def test_not_match(command):
|
|
|
|
assert not match(command, None)
|
2015-04-20 12:32:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
|
|
|
assert get_new_command(Command('rm foo', '', ''), None) == 'rm -rf foo'
|