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
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2015-04-20 22:00:37 +02:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
@pytest.mark.parametrize('script, output', [
|
2015-07-15 07:12:07 +03:00
|
|
|
('cp dir', 'cp: dor: is a directory'),
|
|
|
|
('cp dir', "cp: omitting directory 'dir'")])
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_match(script, output):
|
|
|
|
assert match(Command(script, output))
|
2015-07-15 07:12:07 +03:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
@pytest.mark.parametrize('script, output', [
|
2015-07-15 07:12:07 +03:00
|
|
|
('some dir', 'cp: dor: is a directory'),
|
|
|
|
('some dir', "cp: omitting directory 'dir'"),
|
|
|
|
('cp dir', '')])
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_not_match(script, output):
|
|
|
|
assert not match(Command(script, output))
|
2015-04-20 22:00:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2017-08-31 17:58:56 +02:00
|
|
|
assert get_new_command(Command('cp dir', '')) == 'cp -a dir'
|