source/projects/shoggoth/test/python/shogoth/test_parser.py

41 lines
538 B
Python
Raw Normal View History

2022-05-17 02:31:36 +00:00
#!/usr/bin/env python3
import pytest
2022-06-01 01:04:14 +00:00
from shoggoth.parser import parse
2022-05-17 02:31:36 +00:00
2022-05-31 15:41:10 +00:00
@pytest.mark.parametrize("example", [
2022-05-17 02:31:36 +00:00
"true",
"false",
"nil",
"foo",
'"this is a trivial string"',
2022-05-31 15:41:10 +00:00
r"/this is a trivial pattern/",
2022-05-17 02:31:36 +00:00
"[]",
"[[]]",
"[[[]]]",
"()",
"(())",
"((()))",
"{}",
# Decimals
"10",
"01", # odd but legal
# Octal
"0o7",
# Binary
"0b1",
# Hex
"0x1",
"0xF",
"0xa",
# FIXME: Floats (ugh)
])
def test_parses(example):
assert parse(example)