Skip to content

test: add comprehensive unit tests for Template::Service#453

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/test-service
Draft

test: add comprehensive unit tests for Template::Service#453
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/test-service

Conversation

@toddr-bot

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

Copy link
Copy Markdown
Contributor

What

78 unit tests for Template::Service, the orchestration layer between Template.pm and Template::Context.

Why

Existing t/service.t only has template-based integration tests via test_expect(). No unit-level coverage of constructor config parsing, error recovery dispatch, or pipeline edge cases.

How

Tests exercise every code path in Service.pm:

  • Constructor (18 tests): defaults, string→array coercion, custom DELIMITER splitting, ERROR/ERRORS alias, AUTO_RESET default, DEBUG flag masking, CONTEXT pass-through, context creation failure
  • process() pipeline (36 tests): basic interpolation, PRE/POST_PROCESS ordering, single and nested WRAPPERs, PROCESS override, template variable injection, code ref templates, param isolation between calls, AUTO_RESET on/off, missing template errors, bad PRE/POST/WRAPPER failures, STOP exception output, stash delocalise on error
  • _recover() dispatch (18 tests): non-exception passthrough, stop text extraction, no-handler undef, hash handler type matching, default fallback, no-match-no-default, scalar catch-all, missing handler template, hierarchical exception matching (user.auth → user)
  • DEBUG (2 tests): service debug logging doesn't crash, non-service debug flags ignored

Testing

perl -Ilib t/service_methods.t  # 78/78 pass
make test                        # full suite green

Quality Report

Changes: 1 file changed, 647 insertions(+)

Code scan: 1 issue(s) found

  • t/service_methods.t:0 — 647 lines added

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan

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.

1 participant