testEngine function

Trellis testEngine({
  1. Map<String, String>? templates,
  2. bool strict = true,
  3. String prefix = 'tl',
  4. Map<String, Function>? filters,
  5. List<Processor>? processors,
  6. List<Dialect>? dialects,
  7. bool includeStandard = true,
  8. MessageSource? messageSource,
  9. String? locale,
})

Creates a Trellis engine configured for testing.

Uses MapLoader with the provided templates map and enables strict mode by default. Caching is disabled for test isolation.

final engine = testEngine(templates: {
  'page': '<h1 tl:text="${title}">Default</h1>',
  'nav': '<nav tl:fragment="main">...</nav>',
});

Implementation

Trellis testEngine({
  Map<String, String>? templates,
  bool strict = true,
  String prefix = 'tl',
  Map<String, Function>? filters,
  List<Processor>? processors,
  List<Dialect>? dialects,
  bool includeStandard = true,
  MessageSource? messageSource,
  String? locale,
}) {
  return Trellis(
    loader: MapLoader(templates ?? {}),
    cache: false,
    strict: strict,
    prefix: prefix,
    filters: filters,
    processors: processors,
    dialects: dialects,
    includeStandard: includeStandard,
    messageSource: messageSource,
    locale: locale,
  );
}