NAME
    Test::Modern - precision testing for modern perl

SYNOPSIS
       use Test::Modern;
   
       # Your tests here
   
       done_testing;

DESCRIPTION
    Test::Modern provides the best features of Test::More, Test::Fatal,
    Test::Warnings, Test::API, Test::LongString, and Test::Deep, as well as
    ideas from Test::Requires, Test::DescribeMe, Test::Moose, and
    Test::CleanNamespaces.

    Test::Modern also automatically imposes strict and warnings on your
    script.

  Features from Test::More
    Test::Modern exports the following subs from Test::More:

    `ok($truth, $description)`
    `is($got, $expected, $description)`
    `isnt($got, $unexpected, $description)`
    `like($got, $regexp, $description)`
    `unlike($got, $regexp, $description)`
    `is_deeply($got, $expected, $description)`
    `cmp_ok($got, $operator, $expected, $description)`
    `new_ok($class, \@args, $name)`
    `isa_ok($object|$subclass, $class, $name)`
    `can_ok($object|$class, @methods)`
    `pass($description)`
    `fail($description)`
    `subtest($description, sub { ... })`
    `diag(@messages)`
    `note(@messages)`
    `explain(@messages)`
    `skip($why, $count) if $reason`
    `todo_skip($why, $count) if $reason`
    $TODO
    `plan(%plan)`
    `done_testing`
    `BAIL_OUT($reason)`

    The `use_ok`, `require_ok`, `eq_array`, `eq_hash`, and `eq_set` functions
    are also available, but not exported by default. For `use_ok` and
    `require_ok` it's normally better to use the Perl built-ins `use` and
    `require` which will die (failing your test) if things are not OK. For the
    `eq_*` functions, they can usually be replaced by `is_deeply`.

  Features from Test::Fatal
    Test::Modern exports the following subs from Test::Fatal:

    `exception { BLOCK }`

  Features from Test::Warnings
    Test::Modern exports the following subs from Test::Warnings:

    `warning { BLOCK }`
    `warnings { BLOCK }`

    In addition, Test::Modern always enables the `had_no_warnings` test at the
    end of the file, ensuring that your test script generated no warnings
    other than the expected ones which were caught by `warnings` blocks.

  Features from Test::API
    Test::Modern exports the following subs from Test::API:

    `public_ok($package, @functions)`
    `import_ok($package, @functions)`
    `class_api_ok($class, @methods)`

  Features from Test::LongString
    Test::Modern exports the following subs from Test::LongString:

    `is_string($got, $expected, $description)`
    `is_string_nows($got, $expected, $description)`
    `like_string($got, $regexp, $description)`
    `unlike_string($got, $regexp, $description)`
    `contains_string($haystack, $needle, $description)`
    `lacks_string($haystack, $needle, $description)`

  Features from Test::Deep
    Test::Modern exports the following subs from Test::Deep:

    `cmp_deeply($got, $expected, $description)`

    The following are not exported by default, but can be exported upon
    request:

    `ignore()`
    `methods(%hash)`
    `listmethods(%hash)`
    `shallow($thing)`
    `noclass($thing)`
    `useclass($thing)`
    `re($regexp, $capture_data, $flags)`
    `superhashof(\%hash)`
    `subhashof(\%hash)`
    `bag(@elements)`
    `set(@elements)`
    `superbagof(@elements)`
    `subbagof(@elements)`
    `supersetof(@elements)`
    `subsetof(@elements)`
    `all(@expecteds)`
    `any(@expecteds)`
    `obj_isa($class)`
    `array_each($thing)`
    `str($string)`
    `num($number, $tolerance)`
    `bool($value)`
    `code(\&subref)`

    As an alternative to using those functions, Test::Modern exports a
    constant `TD` upon which you can call them as methods:

       # like Test::Deep::bag(@elements)
       TD->bag(@elements)

  Features inspired by Test::Moose
    Test::Modern does not use Test::Moose, but does provide the following
    function inspired by it:

    `does_ok($object|$subclass, $class, $name)`
        Like `isa_ok`, but calls `$obj->DOES` instead of `$obj->isa`.

  Features inspired by Test::CleanNamespaces
    Test::Modern does not use Test::CleanNamespaces, but does provide the
    following function inspired by it:

    `namespaces_clean(@namespaces)`
        Tests that namespaces don't contain any imported functions. (i.e. you
        haven't forgotten to use namespace::autoclean or namespace::sweep in a
        class).

        Unlike the version of this function supplied with
        Test::CleanNamespaces, if @namespaces contains more than one
        namespace, these will be run in a subtest, so the whole thing will
        only count as one test.

  Features inspired by Test::Requires
    Test::Modern does not use Test::Requires, but does provide the following
    feature inspired by it:

    `use Test::Modern -requires => \%requirements`
        This will skip the entire test script if the requirements are not met.
        For example:

           use Test::Modern -requires => {
              'perl'                 => '5.010',
              'Moose'                => '2.11',
              'namespace::autoclean' => undef,
           };

  Features inspired by Test::DescribeMe
    These export tags allow you to classify tests as "author tests", "release
    tests", "extended tests", or "interactive tests".

    They will cause your test script to be skipped depending on various
    environment variables.

    `use Test::Modern -author`
    `use Test::Modern -release`
    `use Test::Modern -extended`
    `use Test::Modern -interactive`

  Brand Spanking New Features
    Test::Modern provides a shortcut which combines several features it has
    pilfered from other testing modules:

    `object_ok($object, $name, %tests)`
        Runs a gamut of subtests on an object:

           object_ok(
              $object,
              $name,
              isa   => \@classes,
              does  => \@roles,
              can   => \@methods,
              api   => \@methods,
              clean => $boolean,
              more  => sub {
                 my $object = shift;
                 ...;
              }
           );

        $object may be a blessed object, or an unblessed coderef which returns
        a blessed object. The `isa` test runs `isa_ok`; the `does` test runs
        `does_ok`, the `can` test runs `can_ok`, and the `api` test runs
        `class_api_ok`. `clean` allows you to run `namespaces_clean` on the
        object's class.

        `more` introduces a coderef for running more tests. Within this sub
        you can use any of the standard Test::More, Test::LongString, etc
        tests. It is automatically run in a `try` block (see Try::Tiny);
        throwing an exception will cause the test to fail, but not cause the
        script to end.

        Any of the test hash keys may be omitted, in which case that test will
        not be run. $name may be omitted.

        If the test succeeds, it returns the object (which may be useful for
        further tests). Otherwise, returns `undef`.

        Practical example:

           my $bob = object_ok(
              sub { Employee->new(name => 'Robert Jones') },
              '$bob',
              isa   => [qw( Employee Person Moo::Object )],
              does  => [qw( Employable )],
              can   => [qw( name employee_number tax_code )],
              clean => 1,
              more  => sub {
                 my $object = shift;
                 is($object->name, "Robert Jones");
                 like($object->employee_number, qr/^[0-9]+$/);
              },
           );
   
           # make further use of $bob
           object_ok(
              sub { $bob->line_manager },
              isa   => [qw( Person )],
           );

EXPORT
    This module uses Exporter::Tiny to perform its exports. This allows
    exported subs to be renamed, etc.

    The following export tags are supported:

    `-more`
        Exports the "Features from Test::More", except deprecated ones.

    `-deprecated`
        Exports the deprecated Test::More features.

    `-fatal`
        Exports the "Features from Test::Fatal".

    `-warnings`
        Exports the "Features from Test::Warnings".

    `-api`
        Exports the "Features from Test::API", including `class_api_ok`.

    `-strings`
        Exports the "Features from Test::LongString".

    `-deep`
        Exports cmp_deeply and TD.

    `-deeper`
        Exports *all* the "Features from Test::Deep".

    `-moose`
        Exports the "Features inspired by Test::Moose".

    `-clean`
        Exports the "Features inspired by Test::CleanNamespaces".

    `-default`
        Exports the default features -- all of the above except `-deprecated`
        and `-deeper`. Also exports `object_ok`.

    `-all`
        Exports all of the above features *including* `-deprecated`,
        `-deeper`, and `object_ok`.

    `-author`, `-extended`, `-interactive`, and `-release`
        Classify the test script.

    `-requires`
        Specify test requirements.

    $TODO is currently *always* exported.

BUGS
    Please report any bugs to
    <http://rt.cpan.org/Dist/Display.html?Queue=Test-Modern>.

SEE ALSO
    My Favourite Test::* Modules
    <http://blogs.perl.org/users/toby_inkster/2014/02/my-favourite-test-module
    s.html>, Precision Testing for Modern Perl
    <http://blogs.perl.org/users/toby_inkster/2014/03/precision-testing-for-mo
    dern-perl.html>.

    Test::More, Test::Fatal, Test::Warnings, Test::API, Test::LongString,
    Test::Deep, Test::Moose, Test::CleanNamespaces, Test::Requires,
    Test::DescribeMe.

    Test::Most is a similar idea, but provides a slightly different
    combination of features.

AUTHOR
    Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE
    This software is copyright (c) 2014 by Toby Inkster.

    This is free software; you can redistribute it and/or modify it under the
    same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES
    THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
    WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
    MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

