1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 10:51:11 +01:00
thefuck/tests/rules/test_rm_root.py

22 lines
657 B
Python
Raw Normal View History

import pytest
2015-04-22 15:22:10 +01:00
from thefuck.rules.rm_root import match, get_new_command
from tests.utils import Command
2015-04-22 15:22:10 +01:00
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)
2015-04-22 15:22:10 +01:00
def test_get_new_command():
assert get_new_command(Command(script='rm -rf /'), None) \
== 'rm -rf / --no-preserve-root'