in reply to Re: TAP test question
in thread TAP test question

I am assuming that Exporter does its job. I just want to make sure that it is indeed the ':all' marker that is available to MyModule.pm programmer... as long as the module is in development. In case someone decided to rename it to something .. e.g 'all' or ':All'. This is what the output looks like when I don't nest
ok 3 - use MyModule::Common;
nested ok(use_ok()) -- results in two tests
ok 4 - use MyModule::Common; ok 5 - Can use ':all' to import all subs that MyModule::Common exports
nested - mistyped ':All' marker
ok(use_ok('ICDP::Common', ':All'),
"All" is not defined in %MyModule::Common::EXPORT_TAGS at /usr/local/s +hare/perl/5.8.8/Test/More.pm line 676 not ok 3 - use MyModule::Common; # Failed test 'use MyModule::Common;' # at .../t/MyModule/Common/Common.t line 23. # Tried to use 'MyModule::Common'. # Error: Can't continue after import errors at (eval 5) line 2 # BEGIN failed--compilation aborted at (eval 5) line 2. not ok 4 - Can use ':all' to import all subs that MyModule::Common exp +orts
Another matter would be to test that the list of subs corresponding to the :all label matches some expected values. How do I do that? Well, I think I must re-read the Test::XXX documentation first.

Replies are listed 'Best First'.
Re^3: TAP test question
by moritz (Cardinal) on Jun 04, 2008 at 17:07 UTC
    Another matter would be to test that the list of subs corresponding to the :all label matches some expected values. How do I do that?

    You can look at the symbol table (see perlmod for details) and see if all the expected symbols were exported.

    But I advice against it, because then you have to maintain the list of what :all means in two places, and repetition is your biggest enemy when writing and maintaining software.

      repetition is your biggest enemy when writing and maintaining software

      Thank you for saying that. Being unable to convince some folks of its veracity makes me crazy sometimes and seeing it out of the blue from a capable hacker just restored some sanity.