xonsh/tests/test_xonsh.xsh

25 lines
534 B
Python
Raw Normal View History

2017-02-15 12:01:04 +08:00
import builtins
2016-08-18 21:50:06 +02:00
def test_simple():
assert 1 + 1 == 2
2016-09-09 00:08:13 -04:00
2016-08-18 21:50:06 +02:00
def test_envionment():
$USER = 'snail'
x = 'USER'
assert x in ${...}
assert ${'U' + 'SER'} == 'snail'
2016-09-09 00:08:13 -04:00
2016-08-18 21:50:06 +02:00
def test_xonsh_party():
2018-09-13 14:03:35 -04:00
orig = builtins.__xonsh__.env.get('XONSH_INTERACTIVE')
builtins.__xonsh__.env['XONSH_INTERACTIVE'] = False
2017-02-15 12:01:04 +08:00
try:
x = 'xonsh'
y = 'party'
out = $(echo @(x + '-' + y)).strip()
assert out == 'xonsh-party', 'Out really was <' + out + '>, sorry.'
finally:
2018-09-13 14:03:35 -04:00
builtins.__xonsh__.env['XONSH_INTERACTIVE'] = orig