1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

Adding unittest for cd_correction (with extra fish test case, also for cd_mkdir)

This commit is contained in:
Alex Barcelo 2018-02-16 23:43:19 +01:00
parent e73dd3f6d1
commit 150ecee00f
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,23 @@
import pytest
from thefuck.rules.cd_correction 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)
# Note that get_new_command uses local filesystem, so not testing it here.
# Instead, see the functional test `functional.test_cd_correction`

View File

@ -7,7 +7,8 @@ from thefuck.types import 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/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)