1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-24 19:48:48 +00:00
thefuck/tests/rules/test_git_direct_commit.py
2022-06-10 15:19:32 +00:00

29 lines
804 B
Python

import pytest
from thefuck.rules.git_direct_commit import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize(
"script, output",
[('''git commit -m "make an other commit"''', "Changes not staged for commit")]
)
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize(
"script, output",
[('''git commit -m "make a commit"''', "")]
)
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.mark.parametrize(
"script, output, new_command",
[("git commit -m 'make a commit'", "Untracked files", "git add --all && git commit -m 'make a commit'")]
)
def test_get_new_command(script, output, new_command):
assert get_new_command(Command(script, output)) == new_command