2015-07-15 07:12:07 +03:00
|
|
|
import pytest
|
2015-04-20 22:00:37 +02:00
|
|
|
from thefuck.rules.cp_omitting_directory import match, get_new_command
|
2015-07-15 07:12:07 +03:00
|
|
|
from tests.utils import Command
|
2015-04-20 22:00:37 +02:00
|
|
|
|
|
|
|
|
2015-07-15 07:12:07 +03:00
|
|
|
@pytest.mark.parametrize('script, stderr', [
|
|
|
|
('cp dir', 'cp: dor: is a directory'),
|
|
|
|
('cp dir', "cp: omitting directory 'dir'")])
|
|
|
|
def test_match(script, stderr):
|
2015-09-07 13:00:29 +03:00
|
|
|
assert match(Command(script, stderr=stderr))
|
2015-07-15 07:12:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('script, stderr', [
|
|
|
|
('some dir', 'cp: dor: is a directory'),
|
|
|
|
('some dir', "cp: omitting directory 'dir'"),
|
|
|
|
('cp dir', '')])
|
|
|
|
def test_not_match(script, stderr):
|
2015-09-07 13:00:29 +03:00
|
|
|
assert not match(Command(script, stderr=stderr))
|
2015-04-20 22:00:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2015-09-07 13:00:29 +03:00
|
|
|
assert get_new_command(Command(script='cp dir')) == 'cp -a dir'
|