Skip to content

test: add comprehensive unit tests for Template::Document - #454

Merged
atoomic merged 1 commit into
mainfrom
koan.toddr.bot/test-document
Sep 11, 2026
Merged

atoomic merged 1 commit into
mainfrom
koan.toddr.bot/test-document

Conversation

@toddr-bot

@toddr-bot toddr-bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

What

106 unit tests for Template::Document, covering the full public API and internals.

Why

Template::Document is the core compiled-template representation — every template render creates and processes one. No dedicated unit tests existed; coverage came only indirectly through integration tests.

How

Tests cover:

  • Constructor: coderef blocks, string blocks (eval'd), invalid blocks, DEFBLOCKS (coderefs, strings, mixed), METADATA, VARIABLES, defaults
  • Accessors: block(), blocks(), variables(), meta() (filtering rules for _-prefixed keys, name, modtime)
  • AUTOLOAD: metadata access, nonexistent keys
  • process(): visit/leave lifecycle, context passing, _HOT recursion detection (with and without RECURSION flag), error propagation with cleanup
  • as_perl(): output structure, metadata escaping, roundtrip eval, version stamp
  • write_perl_file(): file creation, do-loadable output, invalid filenames, UTF-8 handling
  • catch_warnings(): accumulation behavior
  • Inheritance: Base class integration

Testing

perl -Ilib t/unit-document.t  # 106 tests pass
make test                      # full suite green

Quality Report

Changes: 1 file changed, 668 insertions(+)

Code scan: 1 issue(s) found

  • t/unit-document.t:0 — 668 lines added

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

@atoomic
atoomic marked this pull request as ready for review September 11, 2026 00:54
@atoomic
atoomic merged commit 5d5808e into main Sep 11, 2026
78 checks passed
@atoomic
atoomic deleted the koan.toddr.bot/test-document branch September 11, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants