mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
Introduce the lkt_build_and_run test driver
Transition all relevant testcases to it. In the process, port
docstrings/comments from test.py files to expected_concrete_syntax.lkt
(now test.lkt) sources and fix stylechecks issues there.
(cherry picked from commit e1c4fe5804)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# Check that the Python bindings to wrap/unwrap arrays of structs of arrays work
|
||||
# as expected.
|
||||
|
||||
import lexer_example
|
||||
|
||||
@with_lexer(foo_lexer)
|
||||
@@ -1,35 +0,0 @@
|
||||
"""
|
||||
Check that the Python bindings to wrap/unwrap arrays of structs of arrays work
|
||||
as expected.
|
||||
"""
|
||||
|
||||
from langkit.dsl import ASTNode, Struct, T, UserField
|
||||
from langkit.expressions import Entity, langkit_property
|
||||
|
||||
from utils import build_and_run
|
||||
|
||||
|
||||
class FooNode(ASTNode):
|
||||
pass
|
||||
|
||||
|
||||
class ExampleHolder(Struct):
|
||||
examples = UserField(type=T.Example.entity.array)
|
||||
|
||||
|
||||
class Example(FooNode):
|
||||
@langkit_property(return_type=ExampleHolder.array, public=True)
|
||||
def example_holders():
|
||||
return ExampleHolder.new(examples=Entity.singleton).singleton
|
||||
|
||||
@langkit_property(return_type=ExampleHolder.array, public=True)
|
||||
def identity(a=ExampleHolder.array):
|
||||
return a
|
||||
|
||||
|
||||
build_and_run(
|
||||
lkt_file='expected_concrete_syntax.lkt',
|
||||
py_script='main.py',
|
||||
types_from_lkt=True,
|
||||
)
|
||||
print('Done')
|
||||
@@ -1 +1,2 @@
|
||||
driver: python
|
||||
driver: lkt_build_and_run
|
||||
py_script: main.py
|
||||
|
||||
Reference in New Issue
Block a user