mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 18:21:10 +00:00
c0c584b13a
When adding directories using `mkdir`, intermediate directories have to exist, unless you specify the `-p` option: $ mkdir foo/bar/baz mkdir: foo/bar: No such file or directory $ fuck mkdir -p foo/bar/baz
14 lines
528 B
Python
14 lines
528 B
Python
from thefuck.main import Command
|
|
from thefuck.rules.mkdir_p import match, get_new_command
|
|
|
|
|
|
def test_match():
|
|
assert match(Command('mkdir foo/bar/baz', '', 'mkdir: foo/bar: No such file or directory'), None)
|
|
assert not match(Command('mkdir foo/bar/baz', '', ''), None)
|
|
assert not match(Command('mkdir foo/bar/baz', '', 'foo bar baz'), None)
|
|
assert not match(Command('', '', ''), None)
|
|
|
|
|
|
def test_get_new_command():
|
|
assert get_new_command(Command('mkdir foo/bar/baz', '', ''), None) == 'mkdir -p foo/bar/baz'
|