[poe-commits] SF.net SVN: poe: [2052] trunk/poe/tests/90_regression/rt19908-merlyn-stop.t
Brought to you by:
rcaputo
From: <rc...@us...> - 2006-08-20 06:33:53
|
Revision: 2052 Author: rcaputo Date: 2006-08-19 23:33:46 -0700 (Sat, 19 Aug 2006) ViewCVS: http://svn.sourceforge.net/poe/?rev=2052&view=rev Log Message: ----------- Improve the test by counting _stop invocations and making sure that POE::Kernel->run() exits due to the exception in _stop. Removed some DOSish carriage returns. Modified Paths: -------------- trunk/poe/tests/90_regression/rt19908-merlyn-stop.t Modified: trunk/poe/tests/90_regression/rt19908-merlyn-stop.t =================================================================== --- trunk/poe/tests/90_regression/rt19908-merlyn-stop.t 2006-08-19 22:30:34 UTC (rev 2051) +++ trunk/poe/tests/90_regression/rt19908-merlyn-stop.t 2006-08-20 06:33:46 UTC (rev 2052) @@ -1,27 +1,31 @@ -#!/usr/bin/perl -w -# $Id$ -# vim: filetype=perl - -# Randal Schwartz reported that die() within _stop causes an infinite -# loop. He's right. This tests rt.cpan.org ticket 19908. - -use POE; -use Test::More tests => 2; - -$SIG{ALRM} = sub { exit }; -alarm(5); - -POE::Session->create( - inline_states => { - _start => sub { - pass("started"); - }, - _stop => sub { - die "stop"; - }, - } -); - -POE::Kernel->run(); -$SIG{ALRM} = "IGNORE"; -pass("stopped"); +#!/usr/bin/perl -w +# $Id$ +# vim: filetype=perl + +# Randal Schwartz reported that die() within _stop causes an infinite +# loop. He's right. This tests rt.cpan.org ticket 19908. + +use POE; +use Test::More tests => 3; + +$SIG{ALRM} = sub { exit }; +alarm(5); + +my $stop_count = 0; + +POE::Session->create( + inline_states => { + _start => sub { + pass("started"); + }, + _stop => sub { + $stop_count++; + die "stop\n"; + }, + } +); + +eval { POE::Kernel->run() }; +$SIG{ALRM} = "IGNORE"; +ok($@ eq "stop\n", "stopped due to a 'stop' exception (in _stop)"); +ok($stop_count == 1, "stopped after one _stop"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |