mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 06:38:32 +00:00
modified test_cd_mkdir.py tests so that they work with the modified cd_mkdir.py. Modified test_cd_mkdir.py to work with the chdir.py rule as well and saved it as test_chdir.py. I also added a test for invalid directory names to both test files.
This commit is contained in:
parent
d2dabfde47
commit
6931d37b5e
@ -20,7 +20,13 @@ def test_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')])
|
||||
(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
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('cd <', ''), Command('cd \0', '')])
|
||||
def test_bad_dir_name(command):
|
||||
assert not match(command)
|
||||
|
@ -1,12 +1,12 @@
|
||||
import pytest
|
||||
from thefuck.rules.cd_mkdir import match, get_new_command
|
||||
from thefuck.rules.chdir import match, get_new_command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('chdir foo', 'cannot find the path'),
|
||||
Command('chdir foo/bar', 'can\'t cd to'),
|
||||
Command('chdir foo/bar', 'cannot find paht'),
|
||||
Command('chdir foo/bar', 'cannot find path'),
|
||||
Command('chdir /foo/bar/', 'can\'t cd to')])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
@ -19,7 +19,13 @@ def test_not_match(command):
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command', [
|
||||
(Command('chdir foo', ''), 'mkdir -p foo && chdir foo'),
|
||||
(Command('chdir foo/bar', ''), 'mkdir -p foo/bar && chdir foo/bar')])
|
||||
(Command('chdirfoo', ''), 'mkdir -p foo; chdir foo'),
|
||||
(Command('chdirfoo/bar/baz', ''), 'mkdir -p foo/bar/baz; chdir foo/bar/baz')])
|
||||
def test_get_new_command(command, new_command):
|
||||
assert get_new_command(command) == new_command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('chdir <', ''), Command('chdir \0', '')])
|
||||
def test_bad_dir_name(command):
|
||||
assert not match(command)
|
||||
|
Loading…
x
Reference in New Issue
Block a user