mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
#570: Refine tests
This commit is contained in:
parent
c21dbd2be3
commit
aec8fe3233
@ -1,3 +1,4 @@
|
|||||||
|
import pytest
|
||||||
from thefuck.rules.git_flag_after_filename import match, get_new_command
|
from thefuck.rules.git_flag_after_filename import match, get_new_command
|
||||||
from tests.utils import Command
|
from tests.utils import Command
|
||||||
|
|
||||||
@ -9,15 +10,22 @@ command3 = Command('git log -p README.md --name-only',
|
|||||||
stderr="fatal: bad flag '--name-only' used after filename")
|
stderr="fatal: bad flag '--name-only' used after filename")
|
||||||
|
|
||||||
|
|
||||||
def test_match():
|
@pytest.mark.parametrize('command', [
|
||||||
assert match(command1)
|
command1, command2, command3])
|
||||||
assert match(command2)
|
def test_match(command):
|
||||||
assert match(command3)
|
assert match(command)
|
||||||
assert not match(Command('git log README.md'))
|
|
||||||
assert not match(Command('git log -p README.md'))
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_new_command():
|
@pytest.mark.parametrize('command', [
|
||||||
assert get_new_command(command1) == "git log -p README.md"
|
Command('git log README.md'),
|
||||||
assert get_new_command(command2) == "git log -p README.md CONTRIBUTING.md"
|
Command('git log -p README.md')])
|
||||||
assert get_new_command(command3) == "git log -p --name-only README.md"
|
def test_not_match(command):
|
||||||
|
assert not match(command)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('command, result', [
|
||||||
|
(command1, "git log -p README.md"),
|
||||||
|
(command2, "git log -p README.md CONTRIBUTING.md"),
|
||||||
|
(command3, "git log -p --name-only README.md")])
|
||||||
|
def test_get_new_command(command, result):
|
||||||
|
assert get_new_command(command) == result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user