2015-11-04 23:08:13 -02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2015-05-15 19:09:14 -03:00
|
|
|
from thefuck.rules.grep_recursive import match, get_new_command
|
|
|
|
from tests.utils import Command
|
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2015-09-07 13:00:29 +03:00
|
|
|
assert match(Command('grep blah .', stderr='grep: .: Is a directory'))
|
2015-11-04 23:08:13 -02:00
|
|
|
assert match(Command(u'grep café .', stderr='grep: .: Is a directory'))
|
2015-09-07 13:00:29 +03:00
|
|
|
assert not match(Command())
|
2015-05-15 19:09:14 -03:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2015-11-22 01:19:24 -02:00
|
|
|
assert get_new_command(Command('grep blah .')) == 'grep -r blah .'
|
2015-11-04 23:08:13 -02:00
|
|
|
assert get_new_command(Command(u'grep café .')) == u'grep -r café .'
|