1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-13 22:28:33 +00:00

Test parsing bash command substitution

This is to help address bad corrections like the following (note the
position of the -p flag):

    thefuck 'git log $(git ls-files thefuck | grep python_command) -p'
    git log $(git ls-files thefuck | grep -p python_command) [enter/↑/↓/ctrl+c]
This commit is contained in:
Joseph Frazier 2016-11-17 14:34:55 -05:00
parent 785cb83ff3
commit 892e8a8e65

View File

@ -56,3 +56,8 @@ class TestBash(object):
def test_get_history(self, history_lines, shell):
history_lines(['ls', 'rm'])
assert list(shell.get_history()) == ['ls', 'rm']
def test_split_command(self, shell):
command = 'git log $(git ls-files thefuck | grep python_command) -p'
command_parts = ['git', 'log', '$(git ls-files thefuck | grep python_command)', '-p']
assert shell.split_command(command) == command_parts