Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 54588
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: [TEST] Test case for "unexpected _child(lose) for a detached session from _start"
In november 2009 I reported on the POE mailing list a problem about an unexpected _child(lose) event for a detached session from _start http://www.nntp.perl.org/group/perl.poe/2009/11/msg4684.html This problem has since been fixed. However I've not found any test in the test suite that tests this particular case. t/90_regression/neyuki_detach.t does not check it. So here is one test to add to the POE test suite to avoid regressions. -- Olivier Mengué - http://o.mengue.free.fr/
Subject: detach-in-_start.t
# vim: ts=2 sw=2 sts=2 ft=perl et : use strict; $| = 1; sub POE::Kernel::ASSERT_DEFAULT () { 1 } BEGIN { package POE::Kernel; use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'}); } use Test::More tests => 14; use POE; my $seq = 0; my $_child_fired = 0; POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set('Parent'); is(++$seq, 1, "_start Parent"); POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set('Child'); is(++$seq, 2, "_start Child"); }, _stop => sub { is(++$seq, 6, "_stop Child"); }, }, ); POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set('Detached'); is(++$seq, 4, "_start Detached"); diag "Detaching session 'Detached' from its parent"; $_[KERNEL]->detach_myself; }, _parent => sub { is(++$seq, 5, "_parent Detached"); ok($_[ARG1]->isa("POE::Kernel"), "child parent is POE::Kernel"); }, _stop => sub { $seq++; ok($seq == 8 || $seq == 9, "_stop Detached"); }, }, ); }, _child => sub { $seq++; ok($seq == 3 || $seq == 7, "_child Parent"); $_child_fired++; ok($_[KERNEL]->alias_list($_[ARG1]) ne 'Detached', "$_[STATE]($_[ARG0]) fired for " .$_[KERNEL]->alias_list($_[ARG1]->ID)); }, _stop => sub { $seq++; ok($seq == 8 || $seq == 9, "_stop Parent"); }, }, ); POE::Kernel->run(); pass "_child not fired for session detached in _start" unless $_child_fired != 2; pass "Stopped";
It looks like I missed t/10_units/03_base/19_detach_start.t that Rocco committed in r2764: http://poe.svn.sourceforge.net/viewvc/poe?view=rev&revision=2764 Anyway. The test I submitted above is an improved version and could replace it. The original ticket was RT#51772. -- Olivier Mengué - http://o.mengue.free.fr/
Olivier's test has been added in revision 2802. Thanks!