This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Test-Simple to CPAN version 1.302166
[perl5.git] / cpan / Test-Simple / lib / Test2 / Event / Diag.pm
1 package Test2::Event::Diag;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.302166';
6
7
8 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
9 use Test2::Util::HashBase qw/message/;
10
11 sub init {
12     $_[0]->{+MESSAGE} = 'undef' unless defined $_[0]->{+MESSAGE};
13 }
14
15 sub summary { $_[0]->{+MESSAGE} }
16
17 sub diagnostics { 1 }
18
19 sub facet_data {
20     my $self = shift;
21
22     my $out = $self->common_facet_data;
23
24     $out->{info} = [
25         {
26             tag     => 'DIAG',
27             debug   => 1,
28             details => $self->{+MESSAGE},
29         }
30     ];
31
32     return $out;
33 }
34
35 1;
36
37 __END__
38
39 =pod
40
41 =encoding UTF-8
42
43 =head1 NAME
44
45 Test2::Event::Diag - Diag event type
46
47 =head1 DESCRIPTION
48
49 Diagnostics messages, typically rendered to STDERR.
50
51 =head1 SYNOPSIS
52
53     use Test2::API qw/context/;
54     use Test2::Event::Diag;
55
56     my $ctx = context();
57     my $event = $ctx->diag($message);
58
59 =head1 ACCESSORS
60
61 =over 4
62
63 =item $diag->message
64
65 The message for the diag.
66
67 =back
68
69 =head1 SOURCE
70
71 The source code repository for Test2 can be found at
72 F<http://github.com/Test-More/test-more/>.
73
74 =head1 MAINTAINERS
75
76 =over 4
77
78 =item Chad Granum E<lt>exodist@cpan.orgE<gt>
79
80 =back
81
82 =head1 AUTHORS
83
84 =over 4
85
86 =item Chad Granum E<lt>exodist@cpan.orgE<gt>
87
88 =back
89
90 =head1 COPYRIGHT
91
92 Copyright 2019 Chad Granum E<lt>exodist@cpan.orgE<gt>.
93
94 This program is free software; you can redistribute it and/or
95 modify it under the same terms as Perl itself.
96
97 See F<http://dev.perl.org/licenses/>
98
99 =cut