# Generated by Pod::WikiDoc version 0.18

=pod

=head1 NAME

Test::API - Test a list of subroutines provided by a module

=head1 VERSION

This documentation describes version 0.002.

=head1 SYNOPSIS

     use Test::More tests => 3;
     use Test::API;
 
     require_ok( 'My::Package' );
 
     public_ok ( 'My::Package', @names );
 
     import_ok ( 'My::Package',
         export    => [ 'foo', 'bar' ],
         export_ok => [ 'baz', 'bam' ], 
     );

=head1 DESCRIPTION

This simple test module checks the subroutines provided by a module.  This is
useful for confirming a planned API in testing and ensuring that other
functions aren't unintentionally included via import.

=head1 USAGE

Note: Subroutines in a package starting with an underscore are ignored.
Therefore, do not include them in any list of expected subroutines.

=head2 public_ok

   public_ok( $package, @names );

This function checks that all of the C<<< @names >>> provided are available within the
C<<< $package >>> namespace and that B<only> these subroutines are available.  This
means that subroutines imported from other modules will cause this test to fail
unless they are explicitly included in C<<< @names >>>.

=head2 import_ok

   import_ok ( $package, %spec );

This function checks that C<<< $package >>> correctly exports an expected list of
subroutines and B<only> these subroutines.  The C<<< %spec >>> generally follows 
the style used by L<Exporter>, but in lower case:  

   %spec = (
     export    => [ 'foo', 'bar' ],  # exported automatically
     export_ok => [ 'baz', 'bam' ],  # optional exports
   );

For C<<< export_ok >>>, the test will check for public functions not listed in
C<<< export >>> or C<<< export_ok >>> that can be imported and will fail if any are found.

=head1 BUGS

Please report any bugs or feature requests using the CPAN Request Tracker  
web interface at L<http://rt.cpan.org/Dist/Display.html?Queue=Test-API>

When submitting a bug or request, please include a test-file or a patch to an
existing test-file that illustrates the bug or desired feature.

=head1 SEE ALSO

=over

=item *

L<Test::ClassAPI> -- more geared towards class trees with inheritance

=back

=head1 AUTHOR

David A. Golden (DAGOLDEN)

=head1 COPYRIGHT AND LICENSE

Copyright (c) 2009 by David A. Golden. All rights reserved.

Licensed under Apache License, Version 2.0 (the "License").
You may not use this file except in compliance with the License.
A copy of the License was distributed with this file or you may obtain a 
copy of the License from http:E<sol>E<sol>www.apache.orgE<sol>licensesE<sol>LICENSE-2.0

Files produced as output though the use of this software, shall not be
considered Derivative Works, but shall be considered the original work of the
Licensor.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


