feat: implement CHECK_IS_NULL handling for undef mock returns#39
feat: implement CHECK_IS_NULL handling for undef mock returns#39Koan-Bot wants to merge 3 commits intocpan-authors:mainfrom
Conversation
|
@Koan-Bot rebase |
Rebase: feat: implement CHECK_IS_NULL handling for undef mock returnsBranch Diff: 3 files changed, 233 insertions(+), 15 deletions(-) Review feedback was analyzed and applied. Actions
CICI will be checked asynchronously. Automated by Kōan |
d3f0f7b to
5c7e68c
Compare
|
Failure from smokers @Koan-Bot rebase |
Rebase: feat: implement CHECK_IS_NULL handling for undef mock returnsBranch Diff: 3 files changed, 234 insertions(+), 6 deletions(-) Review feedback was analyzed and applied. Actions
CICI will be checked asynchronously. Automated by Kōan |
5c7e68c to
06e7853
Compare
|
Failures from Perl 5.10, 5.12 and 5.14 on smokers view https://github.com/cpan-authors/Overload-FileCheck/actions/runs/23694139455/job/69026556441?pr=39 for more details @Koan-Bot rebase |
Replace the lazy init guard in unmock_all_file_checks() with a direct eager initialization of %REVERSE_MAP using `reverse %MAP_FC_OP`. Since %MAP_FC_OP is static and known at compile time, there is no benefit to deferring the build. This removes a runtime check on every unmock_all_file_checks() call and makes %REVERSE_MAP available immediately should other code ever need it. Fixes cpan-authors#36 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…llbacks Wire up the CHECK_IS_NULL constant (already exported as undef) so that mock callbacks returning undef cause the OP to return undef to the caller, instead of silently coercing to CHECK_IS_FALSE (0). This matters most for numeric ops (-s, -M, -A, -C) where 0 is a valid return value (file size zero, age zero) and undef means "file not found". The _check_from_stat helper already returned CHECK_IS_NULL for missing stat fields, but the value was being swallowed by the !$out → CHECK_IS_FALSE path in _check(). Changes: - XS: _overload_ft_ops() now pops as SV and detects undef (sentinel -2) - XS: pp_overload_ft_yes_no, pp_overload_ft_int, pp_overload_ft_nv all handle the -2 sentinel with FT_RETURNUNDEF - Perl: _check() propagates undef before the !$out → CHECK_IS_FALSE path - Perl: CHECK_IS_NULL added to @CHECK_STATUS export list - Tests: new t/check-null.t covering boolean, integer, and NV ops Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix applied. The `-s` file-test operator inside `is()` function calls gets misparsed on some Perl versions — the tokenizer consumes arguments differently when `-s EXPR` appears directly as a function argument. The existing test suite (`test-integer.t`) already handles this by using `eval` or temp variables. **Summary for commit message:** - Fix `-s` operator parsing ambiguity in `t/check-null.t` (lines 86, 89): assign `-s` result to a temp variable before passing to `is()`, matching the pattern used by existing tests in `test-integer.t`. The Perl tokenizer misparsed `-s "/path"` as a direct argument to `is()` on CI smokers, causing the filename string to be compared instead of the file-test result.
Rebase: feat: implement CHECK_IS_NULL handling for undef mock returnsBranch Diff: 3 files changed, 240 insertions(+), 6 deletions(-) Review feedback was analyzed and applied. ChangesFix applied. The Summary for commit message:
Actions
CICI will be checked asynchronously. Automated by Kōan |
06e7853 to
5f2925f
Compare
What
Wire up the
CHECK_IS_NULLconstant so mock callbacks returningundefcause the OP to returnundefto the caller.Why
CHECK_IS_NULLwas exported but never acted on (TODO at XS lines 71, 269). Callbacks returningundefwere silently coerced toCHECK_IS_FALSE(0) — harmless for boolean ops, but wrong for numeric ops like-swhere 0 means "file has zero size" andundefmeans "file not found". The_check_from_stathelper already returnedCHECK_IS_NULLfor missing stat fields (e.g.-Mwithout mtime), but the value was swallowed.How
_overload_ft_ops()now pops as SV and checksSvOK()to detect undef, returning -2 as a sentinel. All three PP handlers (pp_overload_ft_yes_no,pp_overload_ft_int,pp_overload_ft_nv) route -2/undef throughFT_RETURNUNDEF._check()propagatesundefearly (before the!$out → CHECK_IS_FALSEpath).CHECK_IS_NULLadded to@CHECK_STATUSexports.Testing
t/check-null.twith 18 tests covering boolean ops (-e, -f, -d), integer op (-s), NV ops (-M, -A, -C), errno behavior, and FALLBACK_TO_REAL_OP coexistence.🤖 Generated with Claude Code
Quality Report
Changes: 3 files changed, 240 insertions(+), 17 deletions(-)
Code scan: clean
Tests: passed (0 Tests)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline