Skip to content

re() with a number fails intermittently #82

@FGasper

Description

@FGasper
use strict;
use warnings;

use Test::More;
use Test::FailWarnings;
use Test::Deep;

cmp_deeply(
    [ qw( h 6 z ) ],
    bag( re('h'), re(6), re('z') ),
    'expected warnings',
);

done_testing;

^^ The above intermittently fails for me.

Happens w/ Perl 5.26 & T::D 1.128.

What seems to happen is that bag() creates two qr/6/ entries; that’s what causes the failure:

> pbpaste | perl
# bless( {
#   'IgnoreDupes' => 0,
#   'SubSup' => '',
#   'val' => [
#     bless( {
#       'val' => qr/h/
#     }, 'Test::Deep::Regexp' ),
#     bless( {
#       'val' => qr/6/
#     }, 'Test::Deep::Regexp' ),
#     $VAR1->{'val'}[1]
#   ]
# }, 'Test::Deep::Set' )
not ok 1 - expected warnings
#   Failed test 'expected warnings'
#   at - line 11.
# Comparing $data as a Bag
# Missing: 1 reference
# Extra: 'z'
1..1
# Looks like you failed 1 test of 1.

ERROR 1
felipe@felipes-mbp 16:42:22 /cpanel
> pbpaste | perl
# bless( {
#   'IgnoreDupes' => 0,
#   'SubSup' => '',
#   'val' => [
#     bless( {
#       'val' => qr/h/
#     }, 'Test::Deep::Regexp' ),
#     bless( {
#       'val' => qr/6/
#     }, 'Test::Deep::Regexp' ),
#     bless( {
#       'val' => qr/z/
#     }, 'Test::Deep::Regexp' )
#   ]
# }, 'Test::Deep::Set' )
ok 1 - expected warnings
1..1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions