4 use Test::More 'no_plan';
10 # =begin testing SETUP
22 requires 'save_state', 'load_state';
28 package Restartable::ButUnreliable;
31 with 'Restartable' => {
36 -excludes => [ 'stop', 'start' ],
42 $self->explode() if rand(1) > .5;
50 $self->explode() if rand(1) > .5;
55 package Restartable::ButBroken;
58 with 'Restartable' => { -excludes => [ 'stop', 'start' ] };
78 my $unreliable = Mouse::Meta::Class->create_anon_class(
80 roles => [qw/Restartable::ButUnreliable/],
82 explode => sub { }, # nop.
83 'save_state' => sub { },
84 'load_state' => sub { },
87 ok( $unreliable, 'made anon class with Restartable::ButUnreliable role' );
88 can_ok( $unreliable, qw/start stop/ );
93 my $broken = Mouse::Meta::Class->create_anon_class(
95 roles => [qw/Restartable::ButBroken/],
97 explode => sub { $cnt++ },
98 'save_state' => sub { },
99 'load_state' => sub { },
103 ok( $broken, 'made anon class with Restartable::ButBroken role' );
107 is( $cnt, 1, '... start called explode' );
111 is( $cnt, 2, '... stop also called explode' );