1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-20 09:39:01 +00:00
thefuck/tests/rules/test_rm_root.py

19 lines
446 B
Python
Raw Normal View History

import pytest
2015-04-22 16:22:10 +02:00
from thefuck.rules.rm_root import match, get_new_command
from thefuck.types import Command
2015-04-22 16:22:10 +02:00
def test_match():
2019-10-25 00:51:47 +03:00
assert match(Command('rm -rf /', ''))
@pytest.mark.parametrize('command', [
Command('ls', 'add --no-preserve-root'),
2019-10-25 00:51:47 +03:00
Command('rm', '/usr/bin/python')])
def test_not_match(command):
assert not match(command)
2015-04-22 16:22:10 +02:00
def test_get_new_command():
2019-10-25 00:51:47 +03:00
assert 'rm' not in (get_new_command(Command('rm -rf /', '')))