Test-Simple

 view release on metacpan or  search on metacpan

lib/Test2/V0.pm  view on Meta::CPAN

    gen_event

    def do_def

    cmp_ok

    warns warning warnings no_warnings

    subtest
    can_ok isa_ok DOES_ok
    set_encoding
    imported_ok not_imported_ok
    ref_ok ref_is ref_is_not
    mock mocked
    dies lives try_ok

    is like isnt unlike
    match mismatch validator
    hash array bag object meta meta_check number float rounded within string subset bool check_isa
    number_lt number_le number_ge number_gt
    in_set not_in_set check_set
    item field call call_list call_hash prop check all_items all_keys all_vals all_values
    etc end filter_items
    T F D DF E DNE FDNE U L
    event fail_events
    exact_ref

    is_refcount is_oneref refcount
};

my $SRAND;
sub import {
    my $class = shift;

    my $caller = caller;
    my (@exports, %options);
    while (my $arg = shift @_) {
        push @exports => $arg and next unless substr($arg, 0, 1) eq '-';
        $options{$arg} = shift @_;
    }

    # SRand handling
    my $srand    = delete $options{'-srand'};

    my $no_srand = exists $options{'-no_srand'};
    delete $options{'-no_srand'} if $no_srand;

    croak "Cannot combine '-srand' and '-no_srand' options"
        if $no_srand && defined($srand);

    if ( !$no_srand ) {
        Test2::Plugin::SRand->import($srand ? $srand : ()) if defined($srand) || !$SRAND++;
    }

    # Pragmas
    my $no_pragmas  = delete $options{'-no_pragmas'};
    my $no_strict   = delete $options{'-no_strict'} || $no_pragmas;
    my $no_warnings = delete $options{'-no_warnings'} || $no_pragmas;
    my $no_utf8     = delete $options{'-no_utf8'} || $no_pragmas;

    strict->import()              unless $no_strict;
    'warnings'->import()          unless $no_warnings;
    Test2::Plugin::UTF8->import() unless $no_utf8;

    my $target = delete $options{'-target'};
    Test2::Tools::Target->import_into($caller, $target)
        if $target;

    croak "Unknown option(s): " . join(', ', sort keys %options) if keys %options;

    Test2::Util::Importer->import_into($class, $caller, @exports);
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Test2::V0 - 0Th edition of the Test2 recommended bundle.

=head1 V1 IS OUT NOW!

See L<Test2::V1> for the most recent "Recommended" bundle.

=head1 DESCRIPTION

This is the big-daddy bundle. This bundle includes nearly every tool, and
several plugins, that the Test2 author uses. This bundle is used
extensively to test L<Test2::Suite> itself.

=head1 NAMING, USING, DEPENDING

This bundle should not change in a I<severely> incompatible way. Some minor
breaking changes, specially bugfixes, may be allowed. If breaking changes are
needed then a new C<Test2::V#> module should be released instead.

As new C<V#> modules are released old ones I<may> be moved to different cpan
distributions. You should always use a specific bundle version and list that
version in your distributions testing requirements. You should never simply
list L<Test2::Suite> as your modules dep, instead list the specific bundle, or
tools and plugins you use directly in your metadata.

=head1 SYNOPSIS

    use Test2::V0;

    ok(1, "pass");

    ...

    done_testing;

=head1 RESOLVING CONFLICTS WITH MOOSE

    use Test2::V0 '!meta';



( run in 1.213 second using v1.01-cache-2.11-cpan-39bf76dae61 )