Hello, world!

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-21 14:07:57 -06:00
commit 02c5f61bb8
7 changed files with 213 additions and 6 deletions
projects/lilith/test/python

View file

@ -0,0 +1,34 @@
"""
"""
from lilith.interpreter import Bindings, Runtime, eval
from lilith.reader import Module
from lilith.parser import Args, Apply
import pytest
@pytest.mark.parametrize('expr, expected', [
(1, 1),
([1, 2], [1, 2]),
({"foo": "bar"}, {"foo": "bar"}),
])
def test_eval(expr, expected):
assert eval(
Runtime("test", dict()),
Module("__repl__", dict()),
Bindings("__root__", None),
expr
) == expected
def test_hello_world(capsys):
assert eval(
Runtime("test", {}),
Module("__repl__", {"print": print}),
Bindings("__root__", None),
Apply("print", Args(["hello, world"], {}))
) is None
captured = capsys.readouterr()
assert captured.out == "hello, world\n"

View file

@ -12,5 +12,4 @@ import pytest
])
def test_read(example, expected):
got = read_buffer(example)
print(got)
assert got == expected