File: simple.t

package info (click to toggle)
liblog-dispatch-array-perl 1.005-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 144 kB
  • sloc: perl: 161; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 734 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;

use Test::More tests => 6;
use Test::Deep;

require_ok('Log::Dispatch');
require_ok('Log::Dispatch::Array');

my $dispatcher = Log::Dispatch->new;
isa_ok($dispatcher, 'Log::Dispatch');

my $array_dispatch = Log::Dispatch::Array->new(
  name      => 'test_logger',
  min_level => 'debug',
);

isa_ok($array_dispatch, 'Log::Dispatch::Array');
isa_ok($array_dispatch, 'Log::Dispatch::Output');

$dispatcher->add($array_dispatch);

$dispatcher->alert("this is your face");
$dispatcher->alert("this is your face on drugs");

cmp_deeply(
  $array_dispatch->array,
  [
    superhashof({ message => 'this is your face' }),
    superhashof({ message => 'this is your face on drugs' }),
  ],
  "we logged stuff",
);