Skip to content

Commit

Permalink
[test] add unit test for no default comment regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Oct 13, 2023
1 parent b48b550 commit 6b77403
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/grammar/syntax_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
import unittest
import pytest

from tatsu.exceptions import FailedParse
from tatsu.exceptions import FailedParse, FailedToken
from tatsu.tool import compile
from tatsu import tool
from tatsu.util import trim
Expand Down Expand Up @@ -363,3 +364,17 @@ def test_parse_void():
ast = tool.parse(grammar, '')
print(ast)
assert ast is None


def test_no_default_comments():
grammar = '''
start = 'a' $;
'''

text = '''
# no comments are valid
a
'''
with pytest.raises(FailedToken):
tool.parse(grammar, text)

0 comments on commit 6b77403

Please sign in to comment.