Navigation Menu

Skip to content
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

Code de-serialization tests fail on perl <= 5.8.7 [rt.cpan.org #81120] #129

Open
ingydotnet opened this issue Aug 14, 2014 · 3 comments
Open

Comments

@ingydotnet
Copy link
Owner

https://rt.cpan.org/Ticket/Display.html?id=81120

t/dump-code.t ............ 1/7 
#   Failed test 'a code ref (n->y)'
#   at
/home/rabbit/.cpanm/work/1352733203.28591/YAML-0.84/blib/lib/Test/YAML.pm line
65.
#          got: '--- !!perl/code |
# {
#     use warnings;
#     use strict 'refs';
#     'Something at least 30 chars';
# }
# '
#     expected: '--- !!perl/code |
# {
#     BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU\001"}
#     use strict 'refs';
#     'Something at least 30 chars';
# }
# '

#   Failed test 'an array of the same code ref (n->y)'
#   at
/home/rabbit/.cpanm/work/1352733203.28591/YAML-0.84/blib/lib/Test/YAML.pm line
65.
#          got: '---
# - &1 !!perl/code |
#   {
#       use warnings;
#       use strict 'refs';
#       'Something at least 30 chars';
#   }
# - *1
# - *1
# '
#     expected: '---
# - &1 !!perl/code |
#   {
#       BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU\001"}
#       use strict 'refs';
#       'Something at least 30 chars';
#   }
# - *1
# - *1
# '

#   Failed test 'blessed code ref (n->y)'
#   at
/home/rabbit/.cpanm/work/1352733203.28591/YAML-0.84/blib/lib/Test/YAML.pm line
65.
#          got: '--- !!perl/code:Foo::Bar |
# {
#     use warnings;
#     use strict 'refs';
#     'Something at least 30 chars';
# }
# '
#     expected: '--- !!perl/code:Foo::Bar |
# {
#     BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU\001"}
#     use strict 'refs';
#     'Something at least 30 chars';
# }
# '
# Looks like you failed 3 tests of 7.
t/dump-code.t ............ Dubious, test returned 3 (wstat 768, 0x300)


t/dump-perl-types.t ...... 1/14 
#   Failed test 'Code'
#   at t/dump-perl-types.t line 18.
#          got: '--- !!perl/code |
# {
#     use warnings;
#     use strict 'refs';
#     print "Hello, world\n";
# }
# '
#     expected: '--- !!perl/code |
# {
#     BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU\001"}
#     use strict 'refs';
#     print "Hello, world\n";
# }
# '

#   Failed test 'Code Glob'
#   at t/dump-perl-types.t line 18.
#          got: '--- !!perl/glob:
# PACKAGE: main
# NAME: var3
# CODE: !!perl/code |
#   {
#       use warnings;
#       use strict 'refs';
#       print "Hello, world\n";
#   }
# '
#     expected: '--- !!perl/glob:
# PACKAGE: main
# NAME: var3
# CODE: !!perl/code |
#   {
#       BEGIN {${^WARNING_BITS} = "UUUUUUUUUUUU\001"}
#       use strict 'refs';
#       print "Hello, world\n";
#   }
# '
# Looks like you failed 2 tests of 14.
t/dump-perl-types.t ...... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/14 subtests 
@ribasushi
Copy link

Any word on this?

@perlpunk
Copy link
Collaborator

perlpunk commented Jul 6, 2016

Previously it was reported that the output depends on the version of B::Deparse.
https://rt.cpan.org/Public/Bug/Display.html?id=73702
That's why the expected strings were changed.

if ($B::Deparse::VERSION > 0.67 and $B::Deparse::VERSION < 0.71) { # [CPAN #73702]
    $data =~ s/use warnings;/BEGIN {\${^WARNING_BITS} = "UUUUUUUUUUUU\\001"}/g;  
}                                                                              

But I just tried out 5.8.6 and 5.8.7 as well - they have B::Deparse 0.69 and 0.70, and I get the same error.
So it might depend on other things.
I'd suggest removing the workaround, make a dev release and watch cpantesters.

@perlpunk
Copy link
Collaborator

perlpunk commented Jul 6, 2016

I played a a little bit.
t/dump-code.t:

use YAML ();   # [CPAN #74687] must load before B::Deparse for B::Deparse < 0.71

use B::Deparse;

Swapping those two lines makes the test succeed on 5.8.6 and 5.8.7, while on 5.8.5 it fails.

Of course, first checking the version of B::Deparse to decide what to do is not an option here. Maybe just skip this test,or make it less strict about that output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants