예제 #1
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_do():
    assert eval(read('(do 1 2)')) == 2
예제 #2
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_eval_func():
    with raises(TypeError):
        assert eval(List([1, 2]))

    assert eval(List([Symbol('+'), 1, 2])) == 3
예제 #3
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_eval_atom():
    assert eval(1) == 1
예제 #4
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_eval_symbol():
    assert eval('+')

    with raises(RuntimeError):
        assert eval(List([Symbol('foo')]))
예제 #5
0
파일: __init__.py 프로젝트: lucian1900/lsp
def lsp(source, env=top):
    return eval(read('(do {0})'.format(source)), env=env)