Tests. Well, test.
This commit is contained in:
parent
3483d99a7d
commit
fb2dff51df
2 changed files with 18 additions and 0 deletions
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
18
tests/test_grammar.py
Normal file
18
tests/test_grammar.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue