diff --git a/tests/test_shells.py b/tests/test_shells.py index bcd0e1fe..c354441f 100644 --- a/tests/test_shells.py +++ b/tests/test_shells.py @@ -44,6 +44,7 @@ class TestBash(object): def Popen(self, mocker): mock = mocker.patch('thefuck.shells.Popen') mock.return_value.stdout.read.return_value = ( + b'alias fuck=\'eval $(thefuck $(fc -ln -1))\'\n' b'alias l=\'ls -CF\'\n' b'alias la=\'ls -A\'\n' b'alias ll=\'ls -alF\'') @@ -51,6 +52,8 @@ class TestBash(object): @pytest.mark.parametrize('before, after', [ ('pwd', 'pwd'), + ('fuck', 'eval $(thefuck $(fc -ln -1))'), + ('awk', 'awk'), ('ll', 'ls -alF')]) def test_from_shell(self, before, after, shell): assert shell.from_shell(before) == after @@ -67,7 +70,8 @@ class TestBash(object): assert shell.and_('ls', 'cd') == 'ls && cd' def test_get_aliases(self, shell): - assert shell.get_aliases() == {'l': 'ls -CF', + assert shell.get_aliases() == {'fuck': 'eval $(thefuck $(fc -ln -1))', + 'l': 'ls -CF', 'la': 'ls -A', 'll': 'ls -alF'} @@ -131,12 +135,14 @@ class TestZsh(object): def Popen(self, mocker): mock = mocker.patch('thefuck.shells.Popen') mock.return_value.stdout.read.return_value = ( + b'fuck=\'eval $(thefuck $(fc -ln -1 | tail -n 1))\'\n' b'l=\'ls -CF\'\n' b'la=\'ls -A\'\n' b'll=\'ls -alF\'') return mock @pytest.mark.parametrize('before, after', [ + ('fuck', 'eval $(thefuck $(fc -ln -1 | tail -n 1))'), ('pwd', 'pwd'), ('ll', 'ls -alF')]) def test_from_shell(self, before, after, shell): @@ -156,6 +162,8 @@ class TestZsh(object): assert shell.and_('ls', 'cd') == 'ls && cd' def test_get_aliases(self, shell): - assert shell.get_aliases() == {'l': 'ls -CF', - 'la': 'ls -A', - 'll': 'ls -alF'} + assert shell.get_aliases() == { + 'fuck': 'eval $(thefuck $(fc -ln -1 | tail -n 1))', + 'l': 'ls -CF', + 'la': 'ls -A', + 'll': 'ls -alF'}