<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">POEâ€GENâ€TESTS(1)      User Contributed Perl Documentation     POEâ€GENâ€TESTS(1)



NNAAMMEE
       poeâˆ’genâˆ’tests âˆ’ generate standard POE tests for thirdâˆ’party modules

SSYYNNOOPPSSIISS
         poeâˆ’genâˆ’tests âˆ’âˆ’dirbase t/loops \
           âˆ’âˆ’loop Glib \
           âˆ’âˆ’loop Kqueue \
           âˆ’âˆ’loop Event::Lib

DDEESSCCRRIIPPTTIIOONN
       This program and the accompanying POE::Test::Loop::* modules make up
       POEâ€™s tests for POE::Loop subclasses.  These tests are designed to run
       identically regardless of the current event loop.  POE uses them to
       test the event loops it bundles:

         POE::Loop::Gtk
         POE::Loop::IO_Poll (âˆ’âˆ’loop IO::Poll)
         POE::Loop::Tk
         POE::Loop::Event
         POE::Loop::Select

       Developers of other POE::Loop modules are encouraged use this package
       to generate over 420 comprehensive tests for their own work.

UUSSAAGGEE
       poeâ€genâ€tests creates test files for one or more event loops beneath
       the directory specified in âˆ’âˆ’dirbase.  For example,

         poeâˆ’genâˆ’tests âˆ’âˆ’dirbase t/loops âˆ’âˆ’loop Select

       generates the following test files:

         t/loops/select/all_errors.t
         t/loops/select/comp_tcp.t
         t/loops/select/comp_tcp_concurrent.t
         t/loops/select/k_alarms.t
         t/loops/select/k_aliases.t
         t/loops/select/k_detach.t
         t/loops/select/k_selects.t
         t/loops/select/k_sig_child.t
         t/loops/select/k_signals.t
         t/loops/select/k_signals_rerun.t
         t/loops/select/sbk_signal_init.t
         t/loops/select/ses_nfa.t
         t/loops/select/ses_session.t
         t/loops/select/wheel_accept.t
         t/loops/select/wheel_curses.t
         t/loops/select/wheel_readline.t
         t/loops/select/wheel_readwrite.t
         t/loops/select/wheel_run.t
         t/loops/select/wheel_sf_ipv6.t
         t/loops/select/wheel_sf_tcp.t
         t/loops/select/wheel_sf_udp.t
         t/loops/select/wheel_sf_unix.t
         t/loops/select/wheel_tail.t

       The âˆ’âˆ’loop parameter completes the POE::Loop::... package name.  It may
       be specified with namespaces separated by "::" or "_".  Event::Lib and
       Event_Lib are identical as far as poeâ€genâ€tests is concerned.

       poeâ€genâ€tests looks for a "=for poe_tests" section within the POE::Loop
       class being tested.  If defined, this section should include a single
       function, _s_k_i_p___t_e_s_t_s_(_), that determines whether any given test should
       be skipped.

       _s_k_i_p___t_e_s_t_s_(_) is called with one parameter, the base name of the test
       about to be executed.  It returns false if the test should run, or a
       message that will be displayed to the user explaining why the test will
       be skipped.  This message is passed directly to Test::Moreâ€™s _p_l_a_n_(_)
       along with "skip_all".  The logic is essentially:

         if (my $why = skip_tests("k_signals_rerun")) {
           plan skip_all =&gt; $why;
         }

       _s_k_i_p___t_e_s_t_s_(_) should load any modules required by the event loop.  See
       most of the examples below.

       EExxaammppllee ppooee__tteessttss DDiirreeccttiivveess

       From POE::Loop::Event

         =for poe_tests

         sub skip_tests {
           my $test_name = shift;
           if ($test_name eq "k_signals_rerun" and $^O eq "MSWin32") {
             return "This test crashes Perl when run with Event on $^O";
           }
           return "Event tests require the Event module" if (
             do { eval "use Event"; $@ }
           );
         }

         =cut

       From POE::Loop::Gtk

         =for poe_tests

         sub skip_tests {
           return "Gtk needs a DISPLAY (set one today, okay?)" unless (
             defined $ENV{DISPLAY} and length $ENV{DISPLAY}
           );
           return "Gtk tests require the Gtk module" if do { eval "use Gtk"; $@ };
           return;
         }

         =cut

       From POE::Loop::IO_Poll

         =for poe_tests

         sub skip_tests {
           return "IO::Poll is not 100% compatible with $^O" if $^O eq "MSWin32";
           return "IO::Poll tests require the IO::Poll module" if (
             do { eval "use IO::Poll"; $@ }
           );
         }

         =cut

       From POE::Loop::Select

         =for poe_tests

         sub skip_tests { return }

         =cut

       From POE::Loop::Tk

         =for poe_tests

         sub skip_tests {
           return "Tk needs a DISPLAY (set one today, okay?)" unless (
             (defined $ENV{DISPLAY} and length $ENV{DISPLAY}) or $^O eq "MSWin32"
           );
           my $test_name = shift;
           if ($test_name eq "k_signals_rerun" and $^O eq "MSWin32") {
             return "This test crashes Perl when run with Tk on $^O";
           }
           return "Tk tests require the Tk module" if do { eval "use Tk"; $@ };
           return;
         }

         =cut

IINNSSTTAALLLL SSCCRRIIPPTT IINNTTEEGGRRAATTIIOONN
       The POE::Loop tests started out as part of the POE distribution.  All
       the recommendations and examples that follow are written and tested
       against ExtUtils::MakeMaker because thatâ€™s what POE uses.  Please
       adjust these recipes according to your taste and preference.

       CCaalllliinngg tthhee TTeesstt GGeenneerraattoorr

       Tests need to be generated prior to the user or CPAN shell running
       "make test".  A tidy way to do this might be to create a new Makefile
       target and include that as a dependency for "make test".  POE takes a
       simpler approach, calling the script from its Makefile.PL:

         system(
           $^X, "poeâˆ’genâˆ’tests", "âˆ’âˆ’dirbase", "t/30_loops",
           "âˆ’âˆ’loop", "Event", "âˆ’âˆ’loop", "Gtk", "âˆ’âˆ’loop", "IO::Poll",
           "âˆ’âˆ’loop", "Select", "âˆ’âˆ’loop", "Tk",
         ) and die $!;

       The previous approach generates tests at install time, so itâ€™s not
       necessary to include the generated files in the MANIFEST.  Test
       directories should also be excluded from the MANIFEST.  poeâ€genâ€tests
       will create the necessary paths.

       Itâ€™s also possible to generate the tests prior to "make dist".  The
       distributionâ€™s MANIFEST must include the generated files in this case.

       Most people will not need to add the generated tests to their
       repositories.

RRuunnnniinngg tthhee TTeessttss
       By default, ExtUtils::MakeMaker generates Makefiles that only run tests
       matching t/*.t.  However authors are allowed to specify other test
       locations.  Add the following parameter to _W_r_i_t_e_M_a_k_e_f_i_l_e_(_) so that the
       tests generated above will be executed:

         tests =&gt; {
           TESTS =&gt; "t/*.t t/30_loops/*/*.t",
         }

CCLLEEAANNIINNGG UUPP
       Makefiles will not clean up files that arenâ€™t present in the MANIFEST.
       This includes tests generated at install time.  If this bothers you,
       youâ€™ll need to add directives to include the generated tests in the
       "clean" and "distclean" targets.

         clean =&gt; {
           FILES =&gt; "t/30_loops/*/* t/30_loops/*",
         }

       This assumes the "t/30_loops" directory contains only generated tests.
       Itâ€™s recommended that generated and handâ€coded tests not coexist in the
       same directory.

       It seems like a good idea to delete the deeper directories and files
       before their parents.

SSkkiippppiinngg NNeettwwoorrkk TTeessttss
       Some generated tests require a network to be present and accessible.
       Those tests will be skipped unless the file "run_network_tests" is
       present in the main distribution directory.  You can include that file
       in your distributionâ€™s tarball, but itâ€™s better create it at install
       time after asking the user.  Hereâ€™s how POE does it.  Naturally youâ€™re
       free to do it some other way.

         # Switch to default behavior if STDIN isnâ€™t a tty.

         unless (âˆ’t STDIN) {
           warn(
             "\n",
             "=============================================\n\n",
             "STDIN is not a terminal.  Assuming âˆ’âˆ’default.\n\n",
             "=============================================\n\n",
           );
           push @ARGV, "âˆ’âˆ’default";
         }

         # Remind the user she can use âˆ’âˆ’default.

         unless (grep /^âˆ’âˆ’default$/, @ARGV) {
           warn(
             "\n",
             "================================================\n\n",
             "Prompts may be bypassed with the âˆ’âˆ’default flag.\n\n",
             "================================================\n\n",
           );
         }

         # Should we run the network tests?

         my $prompt = (
           "Some of POEâ€™s tests require a functional network.\n" .
           "You can skip these tests if youâ€™d like.\n\n" .
           "Would you like to skip the network tests?"
         );

         my $ret = "n";
         if (grep /^âˆ’âˆ’default$/, @ARGV) {
           print $prompt, " [$ret] $ret\n\n";
         }
         else {
           $ret = prompt($prompt, "n");
         }

         my $marker = â€™run_network_testsâ€™;
         unlink $marker;
         if ($ret =~ /^Y$/i) {
           open(TOUCH,"+&gt;$marker") and close TOUCH;
         }

         print "\n";

AAUUTTHHOORR &amp;&amp; CCOOPPYYRRIIGGHHTT
       Rocco Caputo &lt;rcaputo@cpan.org&gt;.  Benjamin Smith &lt;bsmith@cpan.org&gt;.
       Countless other people.

       These tests are Copyright 1998âˆ’2007 by Rocco Caputo, Benjamin Smith,
       and countless contributors.  All rights are reserved.  These tests are
       free software; you may redistribute them and/or modify them under the
       same terms as Perl itself.

       Thanks to Martijn van Beers for beta testing and suggestions.



perl v5.8.8                       2007â€08â€13                  POEâ€GENâ€TESTS(1)
</pre></body></html>