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
|
|
|
|
from tests.utils import Command
|
|
|
|
|
|
|
|
|
|
|
|
def test_match():
|
2015-09-07 11:00:29 +01:00
|
|
|
assert match(Command('grep blah .', stderr='grep: .: Is a directory'))
|
2015-11-05 01:08:13 +00:00
|
|
|
assert match(Command(u'grep café .', stderr='grep: .: Is a directory'))
|
2015-09-07 11:00:29 +01:00
|
|
|
assert not match(Command())
|
2015-05-15 23:09:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_new_command():
|
2015-11-22 03:19:24 +00:00
|
|
|
assert get_new_command(Command('grep blah .')) == 'grep -r blah .'
|
2015-11-05 01:08:13 +00:00
|
|
|
assert get_new_command(Command(u'grep café .')) == u'grep -r café .'
|