File: output_test.t

package info (click to toggle)
libmessage-passing-perl 0.117-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 544 kB
  • sloc: perl: 2,742; makefile: 2; sh: 1
file content (28 lines) | stat: -rw-r--r-- 580 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
use strict;
use warnings;
use Test::More;
use Try::Tiny;

use Message::Passing::Output::Test;

my $called = 0;

my $test = try { Message::Passing::Output::Test->new(cb => sub { $called++ }) }
    catch { fail "Failed to construct $_" };
ok $test;

try { $test->consume('message') }
    catch { fail "Failed to consume message: $_" };

is $test->message_count, 1;
is_deeply [$test->messages], ['message'];
is $called, 1;

try { $test->clear_messages }
    catch { fail "Could not clear messages: $_" };

is $test->message_count, 0;
is_deeply [$test->messages], [];

done_testing;