1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/rules/test_git_help_aliased.py
2017-08-31 17:58:56 +02:00

25 lines
959 B
Python

import pytest
from thefuck.rules.git_help_aliased import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('script, output', [
('git help st', "`git st' is aliased to `status'"),
('git help ds', "`git ds' is aliased to `diff --staged'")])
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize('script, output', [
('git help status', "GIT-STATUS(1)...Git Manual...GIT-STATUS(1)"),
('git help diff', "GIT-DIFF(1)...Git Manual...GIT-DIFF(1)")])
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.mark.parametrize('script, output, new_command', [
('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')])
def test_get_new_command(script, output, new_command):
assert get_new_command(Command(script, output)) == new_command