Get arrays and mappings working

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-21 17:14:57 -06:00
commit d6a811118d
5 changed files with 46 additions and 9 deletions
projects/lilith/test/python

View file

@ -22,6 +22,11 @@ def arguments_grammar():
return parser_with_transformer(GRAMMAR, "arguments")
@pytest.fixture
def expr_grammar():
return parser_with_transformer(GRAMMAR, "expr")
@pytest.fixture
def header_grammar():
return parser_with_transformer(GRAMMAR, "header")

View file

@ -60,6 +60,21 @@ def test_parse_arguments(arguments_grammar, example, expected):
assert arguments_grammar.parse(example) == expected
@pytest.mark.parametrize(
"example, expected",
[
("1", 1),
("[1, 2, 3]", [1, 2, 3]),
('{"a": 1}', {"a": 1}),
("true", True),
("false", False),
("nil", None),
],
)
def test_parse_expr(expr_grammar, example, expected):
assert expr_grammar.parse(example) == expected
@pytest.mark.parametrize(
"example, expected",
[