mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-19 03:32:31 +01:00
Fix fuck when more than one git command available
This commit is contained in:
@@ -12,17 +12,33 @@ branch
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def git_not_command_one_of_this():
|
||||
return """git: 'st' is not a git command. See 'git --help'.
|
||||
|
||||
Did you mean one of these?
|
||||
status
|
||||
reset
|
||||
stage
|
||||
stash
|
||||
stats
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def git_command():
|
||||
return "* master"
|
||||
|
||||
|
||||
def test_match(git_not_command, git_command):
|
||||
def test_match(git_not_command, git_command, git_not_command_one_of_this):
|
||||
assert match(Command('git brnch', '', git_not_command), None)
|
||||
assert match(Command('git st', '', git_not_command_one_of_this), None)
|
||||
assert not match(Command('ls brnch', '', git_not_command), None)
|
||||
assert not match(Command('git branch', '', git_command), None)
|
||||
|
||||
|
||||
def test_get_new_command(git_not_command):
|
||||
def test_get_new_command(git_not_command, git_not_command_one_of_this):
|
||||
assert get_new_command(Command('git brnch', '', git_not_command), None)\
|
||||
== 'git branch'
|
||||
assert get_new_command(
|
||||
Command('git st', '', git_not_command_one_of_this), None) == 'git status'
|
||||
|
Reference in New Issue
Block a user