mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-29 00:22:32 +01:00
#682: Unify work with output in classic and instant mode
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from tests.utils import Command
|
||||
from thefuck.types import Command
|
||||
from thefuck.rules.chmod_x import match, get_new_command
|
||||
|
||||
|
||||
@@ -14,26 +14,26 @@ def file_access(mocker):
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('file_exists', 'file_access')
|
||||
@pytest.mark.parametrize('script, stderr', [
|
||||
@pytest.mark.parametrize('script, output', [
|
||||
('./gradlew build', 'gradlew: Permission denied'),
|
||||
('./install.sh --help', 'install.sh: permission denied')])
|
||||
def test_match(script, stderr):
|
||||
assert match(Command(script, stderr=stderr))
|
||||
def test_match(script, output):
|
||||
assert match(Command(script, output))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, stderr, exists, callable', [
|
||||
@pytest.mark.parametrize('script, output, exists, callable', [
|
||||
('./gradlew build', 'gradlew: Permission denied', True, True),
|
||||
('./gradlew build', 'gradlew: Permission denied', False, False),
|
||||
('./gradlew build', 'gradlew: error', True, False),
|
||||
('gradlew build', 'gradlew: Permission denied', True, False)])
|
||||
def test_not_match(file_exists, file_access, script, stderr, exists, callable):
|
||||
def test_not_match(file_exists, file_access, script, output, exists, callable):
|
||||
file_exists.return_value = exists
|
||||
file_access.return_value = callable
|
||||
assert not match(Command(script, stderr=stderr))
|
||||
assert not match(Command(script, output))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, result', [
|
||||
('./gradlew build', 'chmod +x gradlew && ./gradlew build'),
|
||||
('./install.sh --help', 'chmod +x install.sh && ./install.sh --help')])
|
||||
def test_get_new_command(script, result):
|
||||
assert get_new_command(Command(script)) == result
|
||||
assert get_new_command(Command(script, '')) == result
|
||||
|
Reference in New Issue
Block a user