1 package Test2::Event::Ok;
5 our $VERSION = '1.302056';
8 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
9 use Test2::Util::HashBase qw{
10 pass effective_pass name todo
16 # Do not store objects here, only true or false
17 $self->{+PASS} = $self->{+PASS} ? 1 : 0;
18 $self->{+EFFECTIVE_PASS} = $self->{+PASS} || (defined($self->{+TODO}) ? 1 : 0);
22 no warnings 'redefine';
26 $self->{+TODO} = $todo;
27 $self->{+EFFECTIVE_PASS} = defined($todo) ? 1 : $self->{+PASS};
31 sub increments_count { 1 };
33 sub causes_fail { !$_[0]->{+EFFECTIVE_PASS} }
38 my $name = $self->{+NAME} || "Nameless Assertion";
40 my $todo = $self->{+TODO};
42 $name .= " (TODO: $todo)";
44 elsif (defined $todo) {
61 Test2::Event::Ok - Ok event type
65 Ok events are generated whenever you run a test that produces a result.
66 Examples are C<ok()>, and C<is()>.
70 use Test2::API qw/context/;
74 my $event = $ctx->ok($bool, $name, \@diag);
79 my $event = $ctx->send_event(
91 The original true/false value of whatever was passed into the event (but
92 reduced down to 1 or 0).
94 =item $name = $e->name
98 =item $b = $e->effective_pass
100 This is the true/false value of the test after TODO and similar modifiers are
103 =item $b = $e->allow_bad_name
105 This relaxes the test name checks such that they allow characters that can
106 confuse a TAP parser.
112 The source code repository for Test2 can be found at
113 F<http://github.com/Test-More/test-more/>.
119 =item Chad Granum E<lt>exodist@cpan.orgE<gt>
127 =item Chad Granum E<lt>exodist@cpan.orgE<gt>
133 Copyright 2016 Chad Granum E<lt>exodist@cpan.orgE<gt>.
135 This program is free software; you can redistribute it and/or
136 modify it under the same terms as Perl itself.
138 See F<http://dev.perl.org/licenses/>