Skip to content

Comments

feat: add warnstrict mode for non-fatal strict violations (#24)#203

Draft
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
atoomic:koan.atoomic/warn-strict-mode
Draft

feat: add warnstrict mode for non-fatal strict violations (#24)#203
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
atoomic:koan.atoomic/warn-strict-mode

Conversation

@Koan-Bot
Copy link
Contributor

Summary

Adds a warnstrict import option that warns about unmocked file access instead of dying. This addresses #24.

use Test::MockFile qw< warnstrict >;

When warnstrict is active:

  • is_strict_mode() returns true (all strict checks still run)
  • is_warn_mode() returns true
  • Violations produce carp warnings instead of confess fatals
  • Execution continues, allowing discovery of all unmocked accesses at once

Useful for migrating existing test suites to strict mode incrementally.

Changes

  • New STRICT_MODE_WARN flag (bitmask 8)
  • import() detects warnstrict tag
  • _strict_mode_violation() uses carp instead of confess when warn flag is set
  • New is_warn_mode() helper function
  • POD updated with usage examples
  • New test file t/warnstrict.t (7 subtests)

Test plan

  • CI passes across Perl matrix (5.14–5.40)
  • warnstrict produces warnings for unmocked file access
  • warnstrict does not die on unmocked access
  • Mocked file access produces no warnings in warnstrict mode
  • Multiple unmocked accesses each produce individual warnings
  • is_strict_mode() and is_warn_mode() return correct values

🤖 Generated with Kōan

@Koan-Bot Koan-Bot force-pushed the koan.atoomic/warn-strict-mode branch from c2843ff to e8e8e57 Compare February 23, 2026 04:55
Adds a 'warnstrict' import option that warns about unmocked file access
instead of dying. Useful for migrating existing test suites to strict
mode by discovering all violations at once.

    use Test::MockFile qw< warnstrict >;

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Koan-Bot Koan-Bot force-pushed the koan.atoomic/warn-strict-mode branch from e8e8e57 to c9e5335 Compare February 24, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant