Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /usr/share/doc/perl-Test-Simple/t/Legacy/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Test-Simple/t/Legacy/is_deeply_dne_bug.t
#!/usr/bin/perl -w

# test for rt.cpan.org 20768
#
# There was a bug where the internal "does not exist" object could get
# confused with an overloaded object.

BEGIN {
    if( $ENV{PERL_CORE} ) {
        chdir 't';
        @INC = ('../lib', 'lib');
    }
    else {
        unshift @INC, 't/lib';
    }
}

use strict;
use Test::More tests => 2;

{
    package Foo;

    use overload
    'eq' => \&overload_equiv,
    '==' => \&overload_equiv;

    sub new {
        return bless {}, shift;
    }

    sub overload_equiv {
        if (ref($_[0]) ne 'Foo' || ref($_[1]) ne 'Foo') {
            print ref($_[0]), " ", ref($_[1]), "\n";
            die "Invalid object passed to overload_equiv\n";
        }

        return 1; # change to 0 ... makes little difference
    }
}

my $obj1 = Foo->new();
my $obj2 = Foo->new();

eval { is_deeply([$obj1, $obj2], [$obj1, $obj2]); };
is $@, '';


Spamworldpro Mini