mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
Python's -O command-line option disableds the execution of "assert" statements. In order for the generated Python bindings to work in such a mode, we need to keep assertion logic only in "assert" statements. This commit fixes statements that currently don't respect this principle. Fixes GitHub issue #485 TN: U326-020
27 lines
526 B
Python
27 lines
526 B
Python
"""
|
|
Regression test: check that getting the list of diagnostics and the range of
|
|
text between two tokens works when Python assertions are disabled. This used
|
|
not to work because "operational" code was in assert statements in the Python
|
|
bindings.
|
|
"""
|
|
|
|
from langkit.dsl import ASTNode
|
|
|
|
from utils import build_and_run
|
|
|
|
|
|
class FooNode(ASTNode):
|
|
pass
|
|
|
|
|
|
class Example(FooNode):
|
|
token_node = True
|
|
|
|
|
|
build_and_run(
|
|
lkt_file='expected_concrete_syntax.lkt',
|
|
py_script='main.py',
|
|
python_args=["-O"],
|
|
)
|
|
print('Done')
|