Source code for zyntex.code_generation.premade.test_printer
from ...parsing.syntax import TestDeclaration
from .default_printer import IDefaultPrintable
[docs]
class TestPrinter(IDefaultPrintable):
"""Printer for Zig test declarations."""
[docs]
def print(self, target: TestDeclaration) -> str:
if target.name is None:
return f"test {target.body}"
return f"test {target.name} {target.body}"
[docs]
@staticmethod
def target_type() -> type[TestDeclaration]:
return TestDeclaration