Somewhat working launcher with prelude!
This commit is contained in:
parent
15c7417516
commit
d02f53dc52
11 changed files with 284 additions and 41 deletions
projects/lilith/test/python
|
|
@ -2,8 +2,7 @@
|
|||
Pytest fixtures.
|
||||
"""
|
||||
|
||||
from lilith.parser import Block, parser_with_transformer, GRAMMAR
|
||||
|
||||
from lilith.parser import Block, GRAMMAR, parser_with_transformer
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
"""
|
||||
|
||||
from lilith.interpreter import Bindings, Runtime, eval
|
||||
from lilith.interpreter import Bindings, eval, Runtime
|
||||
from lilith.parser import Apply, Args, Symbol
|
||||
from lilith.reader import Module
|
||||
from lilith.parser import Args, Apply, Symbol
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def runtime():
|
||||
return Runtime("test", None, {})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"expr, expected",
|
||||
[
|
||||
|
|
@ -17,11 +21,11 @@ import pytest
|
|||
({"foo": "bar"}, {"foo": "bar"}),
|
||||
],
|
||||
)
|
||||
def test_eval(expr, expected):
|
||||
def test_eval(runtime, expr, expected):
|
||||
assert (
|
||||
eval(
|
||||
Runtime("test", dict()),
|
||||
Module("__repl__", dict()),
|
||||
runtime,
|
||||
Module("__repl__", [], dict()),
|
||||
Bindings("__root__", None),
|
||||
expr,
|
||||
)
|
||||
|
|
@ -29,11 +33,11 @@ def test_eval(expr, expected):
|
|||
)
|
||||
|
||||
|
||||
def test_hello_world(capsys):
|
||||
def test_hello_world(capsys, runtime):
|
||||
assert (
|
||||
eval(
|
||||
Runtime("test", {}),
|
||||
Module("__repl__", {Symbol("print"): print}),
|
||||
runtime,
|
||||
Module("__repl__", [], {Symbol("print"): print}),
|
||||
Bindings("__root__", None),
|
||||
Apply(Symbol("print"), Args(["hello, world"], {})),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ from lilith.parser import (
|
|||
parser_with_transformer,
|
||||
Symbol,
|
||||
)
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from lilith.parser import Apply, Args, Block, Symbol
|
||||
from lilith.reader import Module, read_buffer
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
|
@ -12,7 +11,8 @@ import pytest
|
|||
(
|
||||
"""!def[main, lang[lil]]\nprint["hello, world"]\n""",
|
||||
Module(
|
||||
"&buff",
|
||||
Symbol("&buff"),
|
||||
[],
|
||||
{
|
||||
Symbol("main"): Block(
|
||||
Apply(Symbol("lang"), Args([Symbol("lil")], {})),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue