File: diag_event_on_ok.t

package info (click to toggle)
libtest-simple-perl 1.302211-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,972 kB
  • sloc: perl: 19,894; makefile: 7
file content (21 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use warnings;

use Test2::Tools::Tiny;
use Test2::API qw/intercept/;
use Test::More ();

my $events = intercept {
    Test::More::ok(0, 'name');
};

my ($ok, $diag) = @$events;

ok($ok->isa('Test2::Event::Ok'), "got 'ok' result");
is($ok->pass, 0, "'ok' test failed");
is($ok->name, 'name', "got 'ok' name");

ok($diag->isa('Test2::Event::Diag'), "got 'ok' result");
is($diag->message, "  Failed test 'name'\n  at $0 line 9.\n", "got all diag message in one diag event");

done_testing;