Skip to content

Conversation

richardleach
Copy link
Contributor

The :reader tests are not really needed at present, as pp_leavesub makes the necessary copies, but exploring some fast accessor ideas which bypass that logic has shown the usefulness of having these tests present.

The :writer tests verify that user errors are handled as expected.


  • This set of changes does not require a perldelta entry.

@richardleach richardleach requested a review from leonerd October 10, 2025 21:04
The :reader tests are not really needed at present, as `pp_leavesub` makes
the necessary copies, but exploring some fast accessor ideas which bypass
that logic has shown the usefulness of having these tests present.

A test for :writer on an array field already exists in a separate file.
A comment pointing to that file has been added, and a test for the hash
case added next to the pre-existing test.
# Reading an undefined value has predictable behaviour
$o->empty;
pass("void :reader on an uninitialized field doesn't crash");
ok(!defined scalar $o->empty, 'scalar :reader on uninitialized field is undef');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the similar test below should use:

is(scalar $o->empty, undef, 'scalar :reader on uninitialized field is undef');

since that will report what the define value is, if it turns out to be defined.

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.

3 participants