2016-03-12 18:51:47 -03:00
|
|
|
import pytest
|
|
|
|
from thefuck.rules.git_help_aliased import match, get_new_command
|
2017-08-31 17:58:56 +02:00
|
|
|
from thefuck.types import Command
|
2016-03-12 18:51:47 -03:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
@pytest.mark.parametrize('script, output', [
|
2016-03-12 18:51:47 -03:00
|
|
|
('git help st', "`git st' is aliased to `status'"),
|
|
|
|
('git help ds', "`git ds' is aliased to `diff --staged'")])
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_match(script, output):
|
|
|
|
assert match(Command(script, output))
|
2016-03-12 18:51:47 -03:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
@pytest.mark.parametrize('script, output', [
|
2016-03-12 18:51:47 -03:00
|
|
|
('git help status', "GIT-STATUS(1)...Git Manual...GIT-STATUS(1)"),
|
|
|
|
('git help diff', "GIT-DIFF(1)...Git Manual...GIT-DIFF(1)")])
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_not_match(script, output):
|
|
|
|
assert not match(Command(script, output))
|
2016-03-12 18:51:47 -03:00
|
|
|
|
|
|
|
|
2017-08-31 17:58:56 +02:00
|
|
|
@pytest.mark.parametrize('script, output, new_command', [
|
2016-03-12 18:51:47 -03:00
|
|
|
('git help st', "`git st' is aliased to `status'", 'git help status'),
|
|
|
|
('git help ds', "`git ds' is aliased to `diff --staged'", 'git help diff')])
|
2017-08-31 17:58:56 +02:00
|
|
|
def test_get_new_command(script, output, new_command):
|
|
|
|
assert get_new_command(Command(script, output)) == new_command
|