Skip to content
Browse files

Added a lot of loop-loading tests, so we can start work on the "naive…

…" loop load hacks
  • Loading branch information...
1 parent 3c01254 commit d146b2f4fe9274b3b749df97aae3e218396caeb2 Larwan Berke committed
View
16 MANIFEST
@@ -100,10 +100,8 @@ t/10_units/03_base/12_assert_retval.t
t/10_units/03_base/13_assert_data.t
t/10_units/03_base/14_kernel.t
t/10_units/03_base/15_kernel_internal.t
-t/10_units/03_base/16_explicit_loop.t
-t/10_units/03_base/17_explicit_loop_fail.t
-t/10_units/03_base/18_nfa_usage.t
-t/10_units/03_base/19_detach_start.t
+t/10_units/03_base/16_nfa_usage.t
+t/10_units/03_base/17_detach_start.t
t/10_units/04_drivers/01_sysrw.t
t/10_units/05_filters/01_block.t
t/10_units/05_filters/02_grep.t
@@ -120,6 +118,16 @@ t/10_units/06_queues/01_array.t
t/10_units/07_exceptions/01_normal.t
t/10_units/07_exceptions/02_turn_off.t
t/10_units/07_exceptions/03_not_handled.t
+t/10_units/08_loops/01_explicit_loop.t
+t/10_units/08_loops/02_explicit_loop_fail.t
+t/10_units/08_loops/03_explicit_loop_poll.t
+t/10_units/08_loops/04_explicit_loop_envvar.t
+t/10_units/08_loops/05_kernel_loop.t
+t/10_units/08_loops/06_kernel_loop_poll.t
+t/10_units/08_loops/07_kernel_loop_fail.t
+t/10_units/08_loops/08_kernel_loop_search_poll.t
+t/10_units/08_loops/09_naive_loop_load.t
+t/10_units/08_loops/10_naive_loop_load_poll.t
t/20_resources/00_base/aliases.pm
t/20_resources/00_base/caller_state.pm
t/20_resources/00_base/events.pm
View
0 t/10_units/03_base/18_nfa_usage.t → t/10_units/03_base/16_nfa_usage.t
File renamed without changes.
View
0 t/10_units/03_base/19_detach_start.t → t/10_units/03_base/17_detach_start.t
File renamed without changes.
View
5 t/10_units/03_base/16_explicit_loop.t → t/10_units/08_loops/01_explicit_loop.t
@@ -3,11 +3,14 @@
use strict;
-use Test::More tests => 1;
+use Test::More tests => 2;
sub POE::Kernel::ASSERT_DEFAULT () { 1 }
BEGIN {
package POE::Kernel;
use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
}
+
BEGIN { use_ok("POE", "Loop::Select") }
+
+is( $poe_kernel->poe_kernel_loop(), 'POE::Loop::Select', "POE loaded the right loop" );
View
0 t/10_units/03_base/17_explicit_loop_fail.t → t/10_units/08_loops/02_explicit_loop_fail.t
File renamed without changes.
View
16 t/10_units/08_loops/03_explicit_loop_poll.t
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 2;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+BEGIN { use_ok("POE", "Loop::IO_Poll") }
+
+is( $poe_kernel->poe_kernel_loop(), 'POE::Loop::IO_Poll', "POE loaded the right loop" );
View
18 t/10_units/08_loops/04_explicit_loop_envvar.t
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 2;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+BEGIN { $ENV{POE_EVENT_LOOP} = "POE::Loop::IO_Poll" }
+
+BEGIN { use_ok("POE") }
+
+is( $poe_kernel->poe_kernel_loop(), 'POE::Loop::IO_Poll', "POE loaded the right loop" );
View
16 t/10_units/08_loops/05_kernel_loop.t
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 2;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+BEGIN { use_ok("POE::Kernel") }
+
+is( $poe_kernel->poe_kernel_loop(), 'POE::Loop::Select', "POE loaded the default loop" );
View
16 t/10_units/08_loops/06_kernel_loop_poll.t
@@ -0,0 +1,16 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 2;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+BEGIN { use_ok("POE::Kernel", { loop => 'IO_Poll' } ) }
+
+is( $poe_kernel->poe_kernel_loop(), 'POE::Loop::IO_Poll', "POE loaded the right loop" );
View
19 t/10_units/08_loops/07_kernel_loop_fail.t
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 1;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+# Hide warnings.
+{
+ local $SIG{__WARN__} = sub { undef };
+ eval "use POE::Kernel { loop => 'NightMooseDontExist' }";
+}
+ok($@, "loading a nonexistent loop throws an error");
View
18 t/10_units/08_loops/08_kernel_loop_search_poll.t
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 3;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+BEGIN { use_ok("IO::Poll") }
+
+BEGIN { use_ok("POE") }
+
+is( $poe_kernel->poe_kernel_loop(), 'POE::Loop::IO_Poll', "POE found the right loop" );
View
37 t/10_units/08_loops/09_naive_loop_load.t
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 2;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+TODO: {
+ local $TODO = 'This feature is not implemented yet';
+
+ # Hide warnings.
+ {
+ local $SIG{__WARN__} = sub { undef };
+ eval "use POE::Loop::Select; use POE";
+ }
+
+ ok(! $@, "Loading a loop the naive way doesn't explode");
+
+ # Hide warnings.
+ my $loop_loaded;
+ {
+ local $SIG{__WARN__} = sub { undef };
+ eval '$loop_loaded = $poe_kernel->poe_kernel_loop()';
+ }
+
+ if ( ! $@ ) {
+ is( $loop_loaded, 'POE::Loop::Select', "POE loaded the right loop" );
+ } else {
+ ok( 0, "Dummy test for TODO" );
+ }
+}
View
37 t/10_units/08_loops/10_naive_loop_load_poll.t
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+# vim: ts=2 sw=2 filetype=perl expandtab
+
+use strict;
+
+use Test::More tests => 2;
+sub POE::Kernel::ASSERT_DEFAULT () { 1 }
+
+BEGIN {
+ package POE::Kernel;
+ use constant TRACE_DEFAULT => exists($INC{'Devel/Cover.pm'});
+}
+
+TODO: {
+ local $TODO = 'This feature is not implemented yet';
+
+ # Hide warnings.
+ {
+ local $SIG{__WARN__} = sub { undef };
+ eval "use POE::Loop::IO_Poll; use POE";
+ }
+
+ ok(! $@, "Loading a loop the naive way doesn't explode");
+
+ # Hide warnings.
+ my $loop_loaded;
+ {
+ local $SIG{__WARN__} = sub { undef };
+ eval '$loop_loaded = $poe_kernel->poe_kernel_loop()';
+ }
+
+ if ( ! $@ ) {
+ is( $loop_loaded, 'POE::Loop::IO_Poll', "POE loaded the right loop" );
+ } else {
+ ok( 0, "Dummy test for TODO" );
+ }
+}

0 comments on commit d146b2f

Please sign in to comment.
Something went wrong with that request. Please try again.