mirror of
https://github.com/nvbn/thefuck.git
synced 2024-10-06 02:41:10 +01:00
ed24e4ca61
commit 8573f94c2f3ba17ec5d7dd123338c14a550e57e6 Author: Vladimir Iakovlev <nvbn.rm@gmail.com> Date: Fri Feb 23 20:45:01 2018 +0100 #785: Remove functional test commit 5484576d6e3ef4a53d69860ef953bb48037e8a72 Merge:a36a8b4
f59aa93
Author: Vladimir Iakovlev <nvbn.rm@gmail.com> Date: Fri Feb 23 20:44:20 2018 +0100 Merge branch 'master' of https://github.com/alexbarcelo/thefuck into alexbarcelo-master commitf59aa931c3
Author: Alex Barcelo <alex.barcelo@gmail.com> Date: Fri Feb 16 23:43:43 2018 +0100 rewritten match + fish output check for cd_* rules commit150ecee00f
Author: Alex Barcelo <alex.barcelo@gmail.com> Date: Fri Feb 16 23:43:19 2018 +0100 Adding unittest for cd_correction (with extra fish test case, also for cd_mkdir) commite73dd3f6d1
Author: Alex Barcelo <alex.barcelo@gmail.com> Date: Fri Feb 16 22:48:22 2018 +0100 adding functional test for cd_correction rule commitd1dbbb57d9
Author: Alex Barcelo <alex@betarho.net> Date: Fri Feb 16 12:21:33 2018 +0100 Include root (start with /) case
27 lines
911 B
Python
27 lines
911 B
Python
import pytest
|
|
from thefuck.rules.cd_mkdir import match, get_new_command
|
|
from thefuck.types import Command
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
Command('cd foo', 'cd: foo: No such file or directory'),
|
|
Command('cd foo/bar/baz',
|
|
'cd: foo: No such file or directory'),
|
|
Command('cd foo/bar/baz', 'cd: can\'t cd to foo/bar/baz'),
|
|
Command('cd /foo/bar/', 'cd: The directory "/foo/bar/" does not exist')])
|
|
def test_match(command):
|
|
assert match(command)
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
Command('cd foo', ''), Command('', '')])
|
|
def test_not_match(command):
|
|
assert not match(command)
|
|
|
|
|
|
@pytest.mark.parametrize('command, new_command', [
|
|
(Command('cd foo', ''), 'mkdir -p foo && cd foo'),
|
|
(Command('cd foo/bar/baz', ''), 'mkdir -p foo/bar/baz && cd foo/bar/baz')])
|
|
def test_get_new_command(command, new_command):
|
|
assert get_new_command(command) == new_command
|