This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
skip a Tets-Simple test that's leaking shm blocks
[perl5.git] / cpan / Test-Simple / t / Test2 / modules / Event.t
CommitLineData
b4514920
CG
1use strict;
2use warnings;
3BEGIN { require "t/tools.pl" };
4
5use Test2::Event();
6
7{
8 package My::MockEvent;
9
10 use base 'Test2::Event';
11 use Test2::Util::HashBase qw/foo bar baz/;
12}
13
14ok(My::MockEvent->can($_), "Added $_ accessor") for qw/foo bar baz/;
15
16my $one = My::MockEvent->new(trace => 'fake');
17
18ok(!$one->causes_fail, "Events do not cause failures by default");
19
20ok(!$one->$_, "$_ is false by default") for qw/increments_count terminate global/;
21
22ok(!$one->get_meta('xxx'), "no meta-data associated for key 'xxx'");
23
24$one->set_meta('xxx', '123');
25
26is($one->meta('xxx'), '123', "got meta-data");
27
28is($one->meta('xxx', '321'), '123', "did not use default");
29
30is($one->meta('yyy', '1221'), '1221', "got the default");
31
32is($one->meta('yyy'), '1221', "last call set the value to the default for future use");
33
34is($one->summary, 'My::MockEvent', "Default summary is event package");
35
36is($one->diagnostics, 0, "Not diagnostics by default");
37
38ok(!$one->in_subtest, "no subtest_id by default");
39
40done_testing;