1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 06:34:09 +00:00

Fix fish shell aliasing (#753)

* Handle user defined fish aliases

* Add more aliases to test

* Revert unecessary Popen mock changes

* Add test for fish aliasing

Fixes #727
This commit is contained in:
David Hart
2018-01-03 04:14:02 +00:00
committed by Joseph Frazier
parent 045c8ae76c
commit 83e1710712
2 changed files with 28 additions and 7 deletions

View File

@@ -13,9 +13,10 @@ class TestFish(object):
@pytest.fixture(autouse=True)
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.return_value = (
mock.return_value.stdout.read.side_effect = [(
b'cd\nfish_config\nfuck\nfunced\nfuncsave\ngrep\nhistory\nll\nls\n'
b'man\nmath\npopd\npushd\nruby')
b'man\nmath\npopd\npushd\nruby'),
b'alias fish_key_reader /usr/bin/fish_key_reader\nalias g git']
return mock
@pytest.mark.parametrize('key, value', [
@@ -42,7 +43,8 @@ class TestFish(object):
('open', 'open'),
('vim', 'vim'),
('ll', 'fish -ic "ll"'),
('ls', 'ls')]) # Fish has no aliases but functions
('ls', 'ls'),
('g', 'git')])
def test_from_shell(self, before, after, shell):
assert shell.from_shell(before) == after
@@ -65,7 +67,9 @@ class TestFish(object):
'math': 'math',
'popd': 'popd',
'pushd': 'pushd',
'ruby': 'ruby'}
'ruby': 'ruby',
'g': 'git',
'fish_key_reader': '/usr/bin/fish_key_reader'}
def test_app_alias(self, shell):
assert 'function fuck' in shell.app_alias('fuck')