The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
NAME
    Test::API - Test a list of subroutines provided by a module

VERSION
    version 0.004

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' ],
        );

        class_api_ok( 'My::Class', @methods );

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.

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

  public_ok
      public_ok( $package, @names );

    This function checks that all of the @names provided are available
    within the $package namespace and that *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 @names.

  class_api_ok
      class_api_ok( $class, @names );

    A variation of "public_ok" for object-oriented modules. Allows
    superclasses to fill in "missing" subroutines, but "extra" methods
    provided by superclasses will not cause the test to fail.

  import_ok
      import_ok ( $package, %spec );

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

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

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

SEE ALSO
    *   Test::ClassAPI -- more geared towards class trees with inheritance

SUPPORT
  Bugs / Feature Requests
    Please report any bugs or feature requests through the issue tracker at
    <https://github.com/dagolden/Test-API/issues>. You will be notified
    automatically of any progress on your issue.

  Source Code
    This is open source software. The code repository is available for
    public review and contribution under the terms of the license.

    <https://github.com/dagolden/Test-API>

      git clone https://github.com/dagolden/Test-API.git

AUTHOR
    David Golden <dagolden@cpan.org>

CONTRIBUTOR
    Toby Inkster <mail@tobyinkster.co.uk>

COPYRIGHT AND LICENSE
    This software is Copyright (c) 2014 by David Golden.

    This is free software, licensed under:

      The Apache License, Version 2.0, January 2004