mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-18 19:22:32 +01:00
#229 Use closest git command
This commit is contained in:
@@ -25,6 +25,16 @@ stats
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def git_not_command_closest():
|
||||
return '''git: 'tags' is not a git command. See 'git --help'.
|
||||
|
||||
Did you mean one of these?
|
||||
stage
|
||||
tag
|
||||
'''
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def git_command():
|
||||
return "* master"
|
||||
@@ -37,8 +47,11 @@ def test_match(git_not_command, git_command, git_not_command_one_of_this):
|
||||
assert not match(Command('git branch', stderr=git_command), None)
|
||||
|
||||
|
||||
def test_get_new_command(git_not_command, git_not_command_one_of_this):
|
||||
assert get_new_command(Command('git brnch', stderr=git_not_command), None)\
|
||||
== 'git branch'
|
||||
def test_get_new_command(git_not_command, git_not_command_one_of_this,
|
||||
git_not_command_closest):
|
||||
assert get_new_command(Command('git brnch', stderr=git_not_command), None) \
|
||||
== 'git branch'
|
||||
assert get_new_command(Command('git st', stderr=git_not_command_one_of_this),
|
||||
None) == 'git status'
|
||||
assert get_new_command(Command('git tags', stderr=git_not_command_closest),
|
||||
None) == 'git tag'
|
||||
|
Reference in New Issue
Block a user