2015-04-25 02:54:39 +02:00
|
|
|
import pytest
|
2015-04-20 18:38:03 +02:00
|
|
|
from thefuck.rules.mkdir_p import match, get_new_command
|
2015-04-25 02:35:26 +02:00
|
|
|
from tests.utils import Command
|
2015-04-20 18:38:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2015-04-25 02:35:26 +02:00
|
|
|
assert match(Command('mkdir foo/bar/baz',
|
|
|
|
stderr='mkdir: foo/bar: No such file or directory'),
|
|
|
|
None)
|
2015-04-25 02:54:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
|
|
Command('mkdir foo/bar/baz'),
|
|
|
|
Command('mkdir foo/bar/baz', stderr='foo bar baz'),
|
|
|
|
Command()])
|
|
|
|
def test_not_match(command):
|
|
|
|
assert not match(command, None)
|
2015-04-20 18:38:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2015-04-25 02:35:26 +02:00
|
|
|
assert get_new_command(Command('mkdir foo/bar/baz'), None)\
|
|
|
|
== 'mkdir -p foo/bar/baz'
|