File: Event.t

package info (click to toggle)
libtest-simple-perl 1.302075-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,844 kB
  • ctags: 628
  • sloc: perl: 10,369; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
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
31
32
33
34
35
36
37
38
39
40
use strict;
use warnings;
use Test2::Tools::Tiny;

use Test2::Event();

{
    package My::MockEvent;

    use base 'Test2::Event';
    use Test2::Util::HashBase qw/foo bar baz/;
}

ok(My::MockEvent->can($_), "Added $_ accessor") for qw/foo bar baz/;

my $one = My::MockEvent->new(trace => 'fake');

ok(!$one->causes_fail, "Events do not cause failures by default");

ok(!$one->$_, "$_ is false by default") for qw/increments_count terminate global/;

ok(!$one->get_meta('xxx'), "no meta-data associated for key 'xxx'");

$one->set_meta('xxx', '123');

is($one->meta('xxx'), '123', "got meta-data");

is($one->meta('xxx', '321'), '123', "did not use default");

is($one->meta('yyy', '1221'), '1221', "got the default");

is($one->meta('yyy'), '1221', "last call set the value to the default for future use");

is($one->summary, 'My::MockEvent', "Default summary is event package");

is($one->diagnostics, 0, "Not diagnostics by default");

ok(!$one->in_subtest, "no subtest_id by default");

done_testing;