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:
@@ -56,3 +56,8 @@ class TestBash(object):
|
|||||||
def test_get_history(self, history_lines, shell):
|
def test_get_history(self, history_lines, shell):
|
||||||
history_lines(['ls', 'rm'])
|
history_lines(['ls', 'rm'])
|
||||||
assert list(shell.get_history()) == ['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
|
||||||
|
|||||||
Reference in New Issue
Block a user