mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +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:
		
				
					committed by
					
						 Joseph Frazier
						Joseph Frazier
					
				
			
			
				
	
			
			
			
						parent
						
							045c8ae76c
						
					
				
				
					commit
					83e1710712
				
			| @@ -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') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user