Skip to content

Commit

Permalink
the MOJO_REACTOR environment variable has to be used manually
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 23, 2015
1 parent a62e5df commit fb4a91f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 0 additions & 2 deletions lib/Mojo/Reactor.pm
Expand Up @@ -38,8 +38,6 @@ Mojo::Reactor - Low-level event reactor base class
package Mojo::Reactor::MyEventLoop;
use Mojo::Base 'Mojo::Reactor';
$ENV{MOJO_REACTOR} ||= 'Mojo::Reactor::MyEventLoop';
sub again {...}
sub io {...}
sub is_running {...}
Expand Down
7 changes: 4 additions & 3 deletions t/mojo/reactor_ev.t
Expand Up @@ -225,15 +225,16 @@ is(Mojo::Reactor->detect, 'Mojo::Reactor::EV', 'right class');
# Dummy reactor
package Mojo::Reactor::Test;
use Mojo::Base 'Mojo::Reactor::Poll';
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Test';

package main;

# Detection (env)
is(Mojo::Reactor->detect, 'Mojo::Reactor::Test', 'right class');
{
local $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Test';
is(Mojo::Reactor->detect, 'Mojo::Reactor::Test', 'right class');
}

# EV in control
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::EV';
is ref Mojo::IOLoop->singleton->reactor, 'Mojo::Reactor::EV', 'right object';
ok !Mojo::IOLoop->is_running, 'loop is not running';
my ($buffer, $server_err, $server_running, $client_err, $client_running);
Expand Down
7 changes: 4 additions & 3 deletions t/mojo/reactor_poll.t
Expand Up @@ -222,15 +222,16 @@ is(Mojo::Reactor::Poll->detect, 'Mojo::Reactor::Poll', 'right class');
# Dummy reactor
package Mojo::Reactor::Test;
use Mojo::Base 'Mojo::Reactor::Poll';
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Test';

package main;

# Detection (env)
is(Mojo::Reactor->detect, 'Mojo::Reactor::Test', 'right class');
{
local $ENV{MOJO_REACTOR} = 'Mojo::Reactor::Test';
is(Mojo::Reactor->detect, 'Mojo::Reactor::Test', 'right class');
}

# Reactor in control
$ENV{MOJO_REACTOR} = 'Mojo::Reactor::Poll';
is ref Mojo::IOLoop->singleton->reactor, 'Mojo::Reactor::Poll', 'right object';
ok !Mojo::IOLoop->is_running, 'loop is not running';
my ($buffer, $server_err, $server_running, $client_err, $client_running);
Expand Down

0 comments on commit fb4a91f

Please sign in to comment.