1
0
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:
Vladimir Iakovlev
2016-11-30 15:49:47 +01:00
committed by GitHub
4 changed files with 32 additions and 3 deletions

View File

@@ -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))']