Skip to content

test: add constructor tests for new() and _passfh#36

Merged
toddr merged 1 commit intocpan-authors:mainfrom
toddr-bot:koan.toddr.bot/test-constructor
Mar 23, 2026
Merged

test: add constructor tests for new() and _passfh#36
toddr merged 1 commit intocpan-authors:mainfrom
toddr-bot:koan.toddr.bot/test-constructor

Conversation

@toddr-bot
Copy link
Collaborator

What

Add t/constructor.t with 27 tests covering the new() constructor and _passfh filehandle resolution.

Why

The _passfh function (which resolves string filehandle names to glob refs) and the new() error paths were only tested via t/Ident.t integration tests that require a running identd. Since CI never has identd available, these code paths were effectively untested in automated runs.

How

Tests exercise new() with every filehandle passing style the module supports (glob ref, bare string, qualified string, FileHandle object, undef) plus newFromInAddr with unreachable addresses. A loopback listener/connect pair tests the full new→query→username path without needing an external identd.

Testing

prove -b t/ — 107 tests across 9 files, all passing.

The _passfh filehandle resolution and new() error paths were only
tested via integration tests that require a running identd (skipped
in CI). This adds 27 unit tests covering:
- Various FH passing styles: glob ref, string, qualified name, FileHandle
- Error-state object behavior (all methods return undef except geterror)
- newFromInAddr with unreachable address
- Connected socket without identd (full new→query→username path)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@toddr toddr marked this pull request as ready for review March 23, 2026 12:41
@toddr toddr merged commit e503342 into cpan-authors:main Mar 23, 2026
23 checks passed
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