atoomic / perl

a repo to show what could be p7
Other
18 stars 8 forks source link

dist/Data-Dumper/t/dumper.t: fails with warnings on by default #317

Closed jkeenan closed 4 years ago

jkeenan commented 4 years ago

Turning on warnings-by-default causes dist/Data-Dumper/t/dumper.t to fail.

In the alpha branch, this test file PASSes. So it's okay with strict-by-default. However, in the alpha-dev-03-warnings branch, I get:

$ cd t; ./perl harness ../dist/Data-Dumper/t/dumper.t; cd -
../dist/Data-Dumper/t/dumper.t .. Failed 2/468 subtests 

Test Summary Report
-------------------
../dist/Data-Dumper/t/dumper.t (Wstat: 0 Tests: 468 Failed: 2)
  Failed tests:  223, 225
Files=1, Tests=468,  1 wallclock secs ( 0.05 usr  0.00 sys +  0.18 cusr  0.02 csys =  0.25 CPU)
Result: FAIL

The failures:

ok 220 - more sortkeys sub (XS)
ok 221 -   no eval error
ok 222 -   works a 2nd time after intervening eval
not ok 223 X - Deparse 1: Indent 2; Dump()
ok 224 -   no eval error
not ok 225 -  re-evaled version 
ok 226 - Numbers

Or:

$ ./perl -Ilib -Idist/Data-Dumper/lib dist/Data-Dumper/t/dumper.t
...
ok 222 -   works a 2nd time after intervening eval
not ok 223 X - Deparse 1: Indent 2; Dump()
--Expected--
 #$VAR1 = {
 #          foo => sub {
 #                     use strict;
 #                     print 'foo';
 #                 }
 #        };

--Got--
 #$VAR1 = {
 #          foo => sub {
 #                     use warnings;
 #                     use strict;
 #                     print 'foo';
 #                 }
 #        };

ok 224 -   no eval error
not ok 225 -  re-evaled version 
--Expected--
 #$VAR1 = {
 #          foo => sub {
 #                     use strict;
 #                     print 'foo';
 #                 }
 #        };

--Got--
 #$VAR1 = {
 #          foo => sub {
 #                     use warnings;
 #                     use strict;
 #                     print 'foo';
 #                 }
 #        };

ok 226 - Numbers
...

So it appears that turning on $Data::Dumper::Deparse causes the output of Dump to change.

This is easy enough to correct -- just include use warnings in the WANT. But before I do that, I want to know that this change of behavior is expected.

@atoomic, can you take a look?

Thank you very much. Jim Keenan

jkeenan commented 4 years ago

I infer from the fact that @atoomic merged the associated p.r. that my understanding was correct. So this ticket can be closed.

Thank you very much. Jim Keenan