summaryrefslogtreecommitdiff
path: root/cpan/Test-Simple/t/Behavior/Munge.t
blob: be9aa98d5c080870e33afa08bec04fa5e7b42cd0 (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
use strict;
use warnings;
use Test::Stream;
use Test::More;
use Test::Stream::Tester;

events_are(
    intercept {
        my $id = 0;
        Test::Stream->shared->munge(sub {
            my ($stream, $e) = @_;
            return unless $e->isa('Test::Stream::Event::Ok');
            return if defined $e->name;
            $e->set_name( 'flubber: ' . $id++ );
        });

        ok( 1, "Keep the name" );
        ok( 1 );
        ok( 1, "Already named" );
        ok( 1 );
    },
    check {
        event ok => { bool => 1, name => "Keep the name" };
        event ok => { bool => 1, name => "flubber: 0" };
        event ok => { bool => 1, name => "Already named" };
        event ok => { bool => 1, name => "flubber: 1" };
    }
);

done_testing;