1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-19 12:24:29 +00:00
thefuck/tests/rules/test_git_bisect_usage.py

31 lines
993 B
Python
Raw Normal View History

2016-09-27 19:42:01 -03:00
import pytest
from thefuck.types import Command
2016-09-27 19:42:01 -03:00
from thefuck.rules.git_bisect_usage import match, get_new_command
@pytest.fixture
def output():
2016-09-27 19:42:01 -03:00
return ("usage: git bisect [help|start|bad|good|new|old"
"|terms|skip|next|reset|visualize|replay|log|run]")
@pytest.mark.parametrize('script', [
'git bisect strt', 'git bisect rset', 'git bisect goood'])
def test_match(output, script):
assert match(Command(script, output))
2016-09-27 19:42:01 -03:00
@pytest.mark.parametrize('script', [
'git bisect', 'git bisect start', 'git bisect good'])
def test_not_match(script):
assert not match(Command(script, ''))
2016-09-27 19:42:01 -03:00
@pytest.mark.parametrize('script, new_cmd, ', [
('git bisect goood', ['good', 'old', 'log']),
('git bisect strt', ['start', 'terms', 'reset']),
('git bisect rset', ['reset', 'next', 'start'])])
def test_get_new_command(output, script, new_cmd):
2016-09-27 19:42:01 -03:00
new_cmd = ['git bisect %s' % cmd for cmd in new_cmd]
assert get_new_command(Command(script, output)) == new_cmd