mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 14:48:49 +00:00
Add: test_get_new_command for testing rules.go_unknown_command.test_get_new_command method.
This commit is contained in:
parent
7b66214894
commit
17a7ea8fc4
@ -1,13 +1,21 @@
|
||||
from thefuck.rules.go_unknown_command import match
|
||||
import pytest
|
||||
from thefuck.rules.go_unknown_command import match, get_new_command
|
||||
from thefuck.types import Command
|
||||
|
||||
_GO_BUILD_MISSPELLED_OUTPUT = """go bulid: unknown command
|
||||
Run 'go help' for usage."""
|
||||
|
||||
@pytest.fixture
|
||||
def build_misspelled_output():
|
||||
return '''go bulid: unknown command
|
||||
Run 'go help' for usage.'''
|
||||
|
||||
|
||||
def test_match():
|
||||
assert match(Command('go bulid', _GO_BUILD_MISSPELLED_OUTPUT))
|
||||
def test_match(build_misspelled_output):
|
||||
assert match(Command('go bulid', build_misspelled_output))
|
||||
|
||||
|
||||
def test_not_match():
|
||||
assert not match(Command('go run', 'go run: no go files listed'))
|
||||
|
||||
|
||||
def test_get_new_command(build_misspelled_output):
|
||||
assert get_new_command(Command('go bulid', build_misspelled_output)) == 'go build'
|
||||
|
Loading…
x
Reference in New Issue
Block a user