From 892e8a8e65a0352cc0ad0a352d5d0c431f77cf0d Mon Sep 17 00:00:00 2001 From: Joseph Frazier <1212jtraceur@gmail.com> Date: Thu, 17 Nov 2016 14:34:55 -0500 Subject: [PATCH] Test parsing bash command substitution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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] --- tests/shells/test_bash.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/shells/test_bash.py b/tests/shells/test_bash.py index c3738f44..a38aff77 100644 --- a/tests/shells/test_bash.py +++ b/tests/shells/test_bash.py @@ -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