summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/Behavior/478-cmp_ok_hash.t
blob: ae82249caf57af30e61c74f92d089627cb567a13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use strict;
use warnings;
use Test::More;

use Test::Stream::Tester;

my $want = 0;
my $got  = 0;

cmp_ok($got, 'eq', $want, "Passes on correct comparison");

my @warn;
my $events = intercept {
    no warnings 'redefine';
    local $SIG{__WARN__} = sub {
        push @warn => @_;
    };
    cmp_ok($got, '#eq', $want, "You shall not pass!");
};

# We are not going to inspect the warning because it is not super predictable,
# and changes with eval specifics.
ok(@warn, "We got warnings");

events_are(
    $events,
    check {
        event ok => {
            bool => 0,
            diag => qr/syntax error at \(eval in cmp_ok\)/,
        };
    },
    "Events meet expectations"
);

done_testing;