mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
added tests for chdir.py in test_chdir.py
This commit is contained in:
parent
28aef57b75
commit
e45e772ae6
@ -199,6 +199,7 @@ following rules are enabled by default:
|
||||
* `cd_cs` – changes `cs` to `cd`;
|
||||
* `cd_mkdir` – creates directories before cd'ing into them;
|
||||
* `cd_parent` – changes `cd..` to `cd ..`;
|
||||
* `chdir` – creates directories before changing into them using chdir;
|
||||
* `chmod_x` – add execution bit;
|
||||
* `choco_install` – append common suffixes for chocolatey packages;
|
||||
* `composer_not_command` – fixes composer command name;
|
||||
|
25
tests/rules/test_chdir.py
Normal file
25
tests/rules/test_chdir.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
from thefuck.rules.cd_mkdir 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/', 'can\'t cd to')])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
Command('chdir foo', ''), Command('', '')])
|
||||
def test_not_match(command):
|
||||
assert 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')])
|
||||
def test_get_new_command(command, new_command):
|
||||
assert get_new_command(command) == new_command
|
@ -8,7 +8,6 @@ import colorama
|
||||
from .conf import settings
|
||||
from . import const
|
||||
|
||||
|
||||
def color(color_):
|
||||
"""Utility for ability to disabling colored output."""
|
||||
if settings.no_colors:
|
||||
|
Loading…
x
Reference in New Issue
Block a user