2015-11-05 01:08:13 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2015-05-15 23:09:14 +01:00
|
|
|
from thefuck.rules.grep_recursive import match, get_new_command
|
2017-08-31 16:58:56 +01:00
|
|
|
from thefuck.types import Command
|
2015-05-15 23:09:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2017-08-31 16:58:56 +01:00
|
|
|
assert match(Command('grep blah .', 'grep: .: Is a directory'))
|
|
|
|
assert match(Command(u'grep café .', 'grep: .: Is a directory'))
|
|
|
|
assert not match(Command('', ''))
|
2015-05-15 23:09:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2017-08-31 16:58:56 +01:00
|
|
|
assert get_new_command(Command('grep blah .', '')) == 'grep -r blah .'
|
|
|
|
assert get_new_command(Command(u'grep café .', '')) == u'grep -r café .'
|