File: 13_assert_data.t

package info (click to toggle)
libpoe-perl 2%3A1.3670-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,996 kB
  • ctags: 1,416
  • sloc: perl: 22,865; makefile: 9
file content (72 lines) | stat: -rw-r--r-- 1,618 bytes parent folder | download | duplicates (7)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/perl -w
# vim: ts=2 sw=2 filetype=perl expandtab

# Test the ASSERT_DATA code in POE::Kernel.  This involves a lot of
# dying.

use strict;
use lib qw(./mylib);

# _explain_resolve_failure
# session_alloc

use Test::More tests => 7;

BEGIN { delete $ENV{POE_ASSERT_USAGE}; }
sub POE::Kernel::ASSERT_DATA    () { 1 }
BEGIN {
  package POE::Kernel;
  use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
}

BEGIN { use_ok("POE") }

# Disable any "didn't call run" warnings.

POE::Kernel->run();

# Session resolution.

eval { $poe_kernel->signal(moo => "signal") };
ok(
  $@ && $@ =~ /Cannot resolve ``moo'' into a session reference/,
  "unresolvable session in signal"
);

eval { $poe_kernel->detach_child("moo") };
ok(
  $@ && $@ =~ /Cannot resolve ``moo'' into a session reference/,
  "unresolvable session in detach_child"
);

eval { $poe_kernel->post(moo => "bar") };
ok(
  $@ && $@ =~ /Cannot resolve ``moo'' into a session reference/,
  "unresolvable session in post"
);

eval { $poe_kernel->call(moo => "bar") };
ok(
  $@ && $@ =~ /Cannot resolve ``moo'' into a session reference/,
  "unresolvable session in call"
);

# Double session allocation.

eval { $poe_kernel->session_alloc($poe_kernel) };
ok(
  $@ && $@ =~ /session .*? already allocated/s,
  "double session_alloc"
);

# Free POE::Kernel to catch some bizarre errors.  Requires us to force
# POE::Kernel's instance to go away.

$poe_kernel->_data_ses_free($poe_kernel->ID);
eval { $poe_kernel->alarm_remove_all() };
ok(
  $@ && $@ =~ /unknown session in alarm_remove_all call/,
  "removing alarms from unknown session"
);

exit 0;