Tests. Well, test.

This commit is contained in:
John Doty 2024-06-15 06:14:37 -07:00
parent 3483d99a7d
commit fb2dff51df
2 changed files with 18 additions and 0 deletions

0
tests/__init__.py Normal file
View file

18
tests/test_grammar.py Normal file
View file

@ -0,0 +1,18 @@
import parser
import pytest
def test_conflicting_names():
"""Terminals and nonterminals can have the same name."""
IDENTIFIER = parser.Terminal("Identifier")
class TestGrammar(parser.Grammar):
start = "Identifier"
@parser.rule("Identifier")
def identifier(self):
return IDENTIFIER
with pytest.raises(ValueError):
TestGrammar().build_table()