mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-30 06:34:09 +00:00
#682: Unify work with output in classic and instant mode
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
from thefuck.rules.ln_no_hard_link import match, get_new_command
|
||||
from tests.utils import Command
|
||||
from thefuck.types import Command
|
||||
|
||||
error = "hard link not allowed for directory"
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, stderr', [
|
||||
@pytest.mark.parametrize('script, output', [
|
||||
("ln barDir barLink", "ln: ‘barDir’: {}"),
|
||||
("sudo ln a b", "ln: ‘a’: {}"),
|
||||
("sudo ln -nbi a b", "ln: ‘a’: {}")])
|
||||
def test_match(script, stderr):
|
||||
command = Command(script, stderr=stderr.format(error))
|
||||
def test_match(script, output):
|
||||
command = Command(script, output.format(error))
|
||||
assert match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('script, stderr', [
|
||||
@pytest.mark.parametrize('script, output', [
|
||||
('', ''),
|
||||
("ln a b", "... hard link"),
|
||||
("sudo ln a b", "... hard link"),
|
||||
("a b", error)])
|
||||
def test_not_match(script, stderr):
|
||||
command = Command(script, stderr=stderr)
|
||||
def test_not_match(script, output):
|
||||
command = Command(script, output)
|
||||
assert not match(command)
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ def test_not_match(script, stderr):
|
||||
("ln a ln", "ln -s a ln"),
|
||||
("sudo ln a ln", "sudo ln -s a ln")])
|
||||
def test_get_new_command(script, result):
|
||||
command = Command(script)
|
||||
command = Command(script, '')
|
||||
assert get_new_command(command) == result
|
||||
|
||||
Reference in New Issue
Block a user