Skip to content

test: add comprehensive unit tests for Template::Filters - #449

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

test: add comprehensive unit tests for Template::Filters#449
atoomic merged 1 commit into
mainfrom
koan.toddr.bot/test-filters

Conversation

@toddr-bot

@toddr-bot toddr-bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

What

290 assertions across 51 subtests exercising every public method, static filter,
dynamic filter factory, and helper function in Template::Filters.

Why

Existing t/filter.t tests filters through template processing (DATA-driven).
No direct unit tests existed for the Filters module API — constructor options,
fetch/store pipeline, error handling, TOLERANT mode, or individual filter
functions called directly.

How

  • Mock context/stash for dynamic filters that need one
  • Test constructor with defaults, custom FILTERS, TOLERANT, and DEBUG
  • Test fetch() for static, dynamic, coderef pass-through, unknown names,
    TOLERANT downgrade, and various error conditions (bad factory, dying factory)
  • Test store() and round-trip fetch of stored filters
  • Direct tests of all 16 static filters (html, xml, uri, url, upper, lower,
    ucfirst, lcfirst, trim, collapse, null, stderr, html_para, html_para_break,
    html_line_break)
  • Direct tests of all 8 dynamic filter factories (indent, format, truncate,
    repeat, replace, remove, eval, perl) plus redirect and stdout
  • HTML entity-aware truncation helpers (_visual_length, _truncate_visual)
  • RFC2732/RFC3986 toggle behavior, UTF-8 URI encoding
  • Registry completeness check and alias verification
  • Package variable defaults

Testing

perl -Ilib t/unit-filters.t   # 290 assertions, 51 subtests, all pass
make test                      # full suite passes

Quality Report

Changes: 1 file changed, 679 insertions(+)

Code scan: 1 issue(s) found

  • t/unit-filters.t:0 — 679 lines added

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic
atoomic marked this pull request as ready for review September 11, 2026 00:55
@atoomic
atoomic merged commit 07070d8 into main Sep 11, 2026
78 checks passed
@atoomic
atoomic deleted the koan.toddr.bot/test-filters branch September 11, 2026 00:55
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