diff options
author | Aaron Crane <arc@cpan.org> | 2016-11-12 16:06:51 +0100 |
---|---|---|
committer | Aaron Crane <arc@cpan.org> | 2016-11-12 16:19:03 +0100 |
commit | 603278a3967e74ac43d71246dfc5ccb5272c0bd3 (patch) | |
tree | f05b600b7fccaa6e136b7ca38c45ecf845a88124 /ext/Devel-Peek | |
parent | df22331bb1386ed8e9549fab14e6aa11e28807d3 (diff) | |
download | perl-603278a3967e74ac43d71246dfc5ccb5272c0bd3.tar.gz |
Test2: __LINE__ and (caller)[2] may be different under Data::Dumper
The __LINE__ token is compiled as an op_const pointing to an SvPV containing
the stringification of the line number. But (caller)[2] yields an SvIV that
directly represents the line number.
Data::Dumper now uses its XS implementation by default, even when its
Deparse option is enabled; previously, Deparse forced use of the pure-Perl
implementation.
The XS and pure-Perl implementations of Data::Dumper differ slightly: the
pure-Perl implementation always dumps defined non-reference scalars with
quotes, while the XS implementation uses a quote-less representation for
small integers. (The precise differences have changed over time, however.)
Test-Simple/t/Test2/modules/API/Context.t uses the minimal testing library
in Test-Simple/t/tools.pl to test itself, and t/tools.pl in turn implements
is_deeply() by doing the equivalent of is(Dumper($got), Dumper($expected)).
Finally, it does is_deeply() on structures containing a line number, but the
"got" structure contains the result of (caller)[2], while the "expected"
structure contains __LINE__. So now that the dumps of those structures are
different, the test fails.
Fix this by doing arithmetic on the __LINE__, thus forcing it to be an IV.
Diffstat (limited to 'ext/Devel-Peek')
0 files changed, 0 insertions, 0 deletions