Skip to content

Test equivalence of 'true' and 'false' to negated statements#19252

Merged
jkeenan merged 1 commit intoPerl:bleadfrom
jkeenan:builtin-more-tests-20211201
Dec 8, 2021
Merged

Test equivalence of 'true' and 'false' to negated statements#19252
jkeenan merged 1 commit intoPerl:bleadfrom
jkeenan:builtin-more-tests-20211201

Conversation

@jkeenan
Copy link
Copy Markdown
Contributor

@jkeenan jkeenan commented Dec 1, 2021

The documentation for lib/builtin.pm asserts that 'true' is equivalent
to !!1 or !0, and that false is equivalent to !!0 or !1. Demonstrate
that this is so.

@jkeenan jkeenan requested a review from leonerd December 1, 2021 13:25
@jkeenan jkeenan self-assigned this Dec 7, 2021
@jkeenan
Copy link
Copy Markdown
Contributor Author

jkeenan commented Dec 7, 2021

@leonerd, if you have any objection to this p.r., can you please let us know?

Otherwise, I plan to merge it within 3 days.

Thank you very much.
Jim Keenan

@leonerd
Copy link
Copy Markdown
Contributor

leonerd commented Dec 7, 2021

is() perhaps isn't the best test for this. It will use either an eq or == internally. Perhaps would be best to cmp_ok them on both of these tests specifically.

jkeenan added a commit to jkeenan/perl5 that referenced this pull request Dec 7, 2021
Per review by Paul Evans in Perl#19252
@jkeenan
Copy link
Copy Markdown
Contributor Author

jkeenan commented Dec 7, 2021

is() perhaps isn't the best test for this. It will use either an eq or == internally. Perhaps would be best to cmp_ok them on both of these tests specifically.

Updated.

Comment thread lib/builtin.t Outdated
@leonerd
Copy link
Copy Markdown
Contributor

leonerd commented Dec 7, 2021

Looking good. Will approve when the CIs are happy (accepting that cygwin is never happy lately)

Copy link
Copy Markdown
Contributor

@leonerd leonerd left a comment

Choose a reason for hiding this comment

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

LGTM. (Though please squash to merge)

The documentation for lib/builtin.pm asserts that 'true' is equivalent
to !!1 or !0, and that false is equivalent to !!0 or !1.  Demonstrate
that this is so.

Per review by Paul Evans in Perl#19252,
we'll use cmp_ok() rather than is() and test for each of 'eq' and '=='.
@jkeenan jkeenan force-pushed the builtin-more-tests-20211201 branch from 4863b40 to b2d0d92 Compare December 7, 2021 23:54
@jkeenan jkeenan merged commit b2d0d92 into Perl:blead Dec 8, 2021
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