mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 12:06:04 +00:00
parent
f1fab0dbb2
commit
8fb5ddefb6
@ -8,10 +8,16 @@ command2 = Command('git log README.md -p CONTRIBUTING.md',
|
||||
"fatal: bad flag '-p' used after filename")
|
||||
command3 = Command('git log -p README.md --name-only',
|
||||
"fatal: bad flag '--name-only' used after filename")
|
||||
command4 = Command('git log README.md -p',
|
||||
"fatal: option '-p' must come before non-option arguments")
|
||||
command5 = Command('git log README.md -p CONTRIBUTING.md',
|
||||
"fatal: option '-p' must come before non-option arguments")
|
||||
command6 = Command('git log -p README.md --name-only',
|
||||
"fatal: option '--name-only' must come before non-option arguments")
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', [
|
||||
command1, command2, command3])
|
||||
command1, command2, command3, command4, command5, command6])
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
@ -26,6 +32,9 @@ def test_not_match(command):
|
||||
@pytest.mark.parametrize('command, result', [
|
||||
(command1, "git log -p README.md"),
|
||||
(command2, "git log -p README.md CONTRIBUTING.md"),
|
||||
(command3, "git log -p --name-only README.md")])
|
||||
(command3, "git log -p --name-only README.md"),
|
||||
(command4, "git log -p README.md"),
|
||||
(command5, "git log -p README.md CONTRIBUTING.md"),
|
||||
(command6, "git log -p --name-only README.md")])
|
||||
def test_get_new_command(command, result):
|
||||
assert get_new_command(command) == result
|
||||
|
@ -2,11 +2,12 @@ import re
|
||||
from thefuck.specific.git import git_support
|
||||
|
||||
error_pattern = "fatal: bad flag '(.*?)' used after filename"
|
||||
error_pattern2 = "fatal: option '(.*?)' must come before non-option arguments"
|
||||
|
||||
|
||||
@git_support
|
||||
def match(command):
|
||||
return re.search(error_pattern, command.output)
|
||||
return re.search(error_pattern, command.output) or re.search(error_pattern2, command.output)
|
||||
|
||||
|
||||
@git_support
|
||||
|
Loading…
x
Reference in New Issue
Block a user