mirror of
https://github.com/nvbn/thefuck.git
synced 2025-10-10 13:54:04 +01:00
#N/A: Split shells
module
This commit is contained in:
44
tests/shells/test_generic.py
Normal file
44
tests/shells/test_generic.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pytest
|
||||
from thefuck.shells import Generic
|
||||
|
||||
|
||||
class TestGeneric(object):
|
||||
@pytest.fixture
|
||||
def shell(self):
|
||||
return Generic()
|
||||
|
||||
def test_from_shell(self, shell):
|
||||
assert shell.from_shell('pwd') == 'pwd'
|
||||
|
||||
def test_to_shell(self, shell):
|
||||
assert shell.to_shell('pwd') == 'pwd'
|
||||
|
||||
def test_put_to_history(self, builtins_open, shell):
|
||||
assert shell.put_to_history('ls') is None
|
||||
assert shell.put_to_history(u'echo café') is None
|
||||
assert builtins_open.call_count == 0
|
||||
|
||||
def test_and_(self, shell):
|
||||
assert shell.and_('ls', 'cd') == 'ls && cd'
|
||||
|
||||
def test_get_aliases(self, shell):
|
||||
assert shell.get_aliases() == {}
|
||||
|
||||
def test_app_alias(self, shell):
|
||||
assert 'alias fuck' in shell.app_alias('fuck')
|
||||
assert 'alias FUCK' in shell.app_alias('FUCK')
|
||||
assert 'thefuck' in shell.app_alias('fuck')
|
||||
assert 'TF_ALIAS=fuck PYTHONIOENCODING' in shell.app_alias('fuck')
|
||||
assert 'PYTHONIOENCODING=utf-8 thefuck' in shell.app_alias('fuck')
|
||||
|
||||
def test_get_history(self, history_lines, shell):
|
||||
history_lines(['ls', 'rm'])
|
||||
# We don't know what to do in generic shell with history lines,
|
||||
# so just ignore them:
|
||||
assert list(shell.get_history()) == []
|
||||
|
||||
def test_split_command(self, shell):
|
||||
assert shell.split_command('ls') == ['ls']
|
||||
assert shell.split_command(u'echo café') == [u'echo', u'café']
|
Reference in New Issue
Block a user