Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (22 sloc) 0.544 kb
a37030c @perigrin add a test that $n got passed right
authored
1 #!/usr/bin/env perl
acd9216 @apocalypse add strict/warnings to all testfiles
apocalypse authored
2 use strict; use warnings;
801a193 @ashb Fix everything! Apart from back-compat
ashb authored
3 use Test::More tests => 3;
b75e86c SweetArgs and test
Hans Dieter Pearcey authored
4
5 {
6 package Counter;
801a193 @ashb Fix everything! Apart from back-compat
ashb authored
7 use MooseX::POE::SweetArgs;
b75e86c SweetArgs and test
Hans Dieter Pearcey authored
8
9 has count => (is => 'rw', default => 1);
10
11 sub START {
12 my ($self) = @_;
13 $self->yield(add => 5);
14 }
15
16 event add => sub {
17 my ($self, $n) = @_;
18 ::is(scalar @_, 2, 'correct number of args');
a37030c @perigrin add a test that $n got passed right
authored
19 ::is($n, 5, 'got the right value');
b75e86c SweetArgs and test
Hans Dieter Pearcey authored
20 $self->count( $self->count + $n );
21 };
22
801a193 @ashb Fix everything! Apart from back-compat
ashb authored
23 no MooseX::POE::SweetArgs;
b75e86c SweetArgs and test
Hans Dieter Pearcey authored
24 }
25
26 my $counter = Counter->new;
27 POE::Kernel->run;
a37030c @perigrin add a test that $n got passed right
authored
28 is($counter->count, 6, 'correct final count');
Something went wrong with that request. Please try again.