mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 12:24:29 +00:00
22 lines
657 B
Python
22 lines
657 B
Python
import pytest
|
|
from thefuck.rules.rm_root import match, get_new_command
|
|
from tests.utils import Command
|
|
|
|
|
|
def test_match():
|
|
assert match(Command(script='rm -rf /',
|
|
stderr='add --no-preserve-root'), None)
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
Command(script='ls', stderr='add --no-preserve-root'),
|
|
Command(script='rm --no-preserve-root /', stderr='add --no-preserve-root'),
|
|
Command(script='rm -rf /', stderr='')])
|
|
def test_not_match(command):
|
|
assert not match(command, None)
|
|
|
|
|
|
def test_get_new_command():
|
|
assert get_new_command(Command(script='rm -rf /'), None) \
|
|
== 'rm -rf / --no-preserve-root'
|