New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test::Builder: Fix "return $a or $b" precedence issue #385
Test::Builder: Fix "return $a or $b" precedence issue #385
Conversation
perl parses "return $a or $b" effectively as "return $a;", which is not what was intended. Signed-off-by: Niels Thykier <niels@thykier.net>
This issue is blocking a patch at https://rt.perl.org/rt3/Ticket/Display.html?id=59802, so I would appreciate it if a new release could manifest itself soon. |
I'm adding my puppy dog eyes to this request for a new release so we can try to break everything as soon as possible, rather than wait too long. 🐶 👀 |
Branch Note: This bug is on branch TestBuilder-1.5, but I think it should be on master, especially if @rjbs wants it for including in perl. Desired Outcome I've tried to write some tests for this at pdl@75dedee but doing so has left me not totally clear what the purpose of the code is. The comment preceding
But the documentation of Scalar::Util at
Whether or not you add the brackets, NB: Although @schwern has elsewhere bitten the bullet and required Scalar::Util elsewhere in Test::More, the version of Scalar::Util which ships with perl does not include Hm. Ideas? Precedence Because of the confusion over the desired outcome, I'm not sure what the intended precedence is. I believe the following are equivalent, which suggests
|
The return value of _is_dualvar affects the diagnostic output when the test fails. Take this for instance:
The output is:
I think the intent is to display the numeric part of a dualvar if the number and string forms are different. But the current logic is such that anything non-zero is nummified (except references). |
In the interest of getting the proposed perl warning tested for as long as possible before perl 5.20, I have applied Niels’ Test::Builder patch to bleadperl as commit 13c65ef8cd5. I bumped the version to 0.98_06, which has not been used in any CPAN release yet. |
I've merged this to test-more/master and will get a trial release out soon and a production release following that. |
I am closing this issue. 0.98_06 is on CPAN now and a production release will follow after two weeks (or so) of testing. |
I know I’m too late in mentioning it, but using a version number on CPAN that blead has already used for a different version is going to cause confusion.... (To prevent that was the whole reason I mentioned the version bump in this thread.) |
I'm getting a precedence issue with the latest on CPAN( return $numval != 0 and $numval ne $val ? 1 : 0; in the http://www.cpantesters.org/cpan/report/43dc9cca-4936-11e3-b097-b376ba4edfeb |
Oh God, sorry, I misread, YAML bundles Test::Builder, so its bundling an old one >:( , My mistake. |
perl parses "return $a or $b" effectively as "return $a;", which is
not what was intended.
Signed-off-by: Niels Thykier niels@thykier.net