mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-29 22:24:44 +00:00
Merge pull request #580 from josephfrazier/bash-command-substitution
bash: fix parsing of command substitution
This commit is contained in:
@@ -56,3 +56,13 @@ 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
|
||||
|
||||
# bashlex doesn't support parsing arithmetic expressions, so make sure
|
||||
# shlex is used a fallback
|
||||
# See https://github.com/idank/bashlex#limitations
|
||||
assert shell.split_command('$((1 + 2))') == ['$((1', '+', '2))']
|
||||
|
||||
Reference in New Issue
Block a user