__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
package Test2::Require;
use strict;
use warnings;
our $VERSION = '0.000162';
use Test2::API qw/context/;
use Carp qw/croak/;
sub skip {
my $class = shift;
croak "Class '$class' needs to implement 'skip()'";
}
sub import {
my $class = shift;
return if $class eq __PACKAGE__;
my $skip = $class->skip(@_);
return unless defined $skip;
my $ctx = context();
$ctx->plan(0, SKIP => $skip || "No reason given.");
$ctx->release;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Test2::Require - Base class and documentation for skip-unless type test
packages.
=head1 DESCRIPTION
Test2::Require::* packages are packages you load to ensure your test file is
skipped unless a specific requirement is met. Modules in this namespace may
subclass L<Test2::Require> if they wish, but it is not strictly necessary to do
so.
=head1 HOW DO I WRITE A 'REQUIRE' MODULE?
=head2 AS A SUBCLASS
package Test2::Require::Widget;
use strict;
use warnings;
use base 'Test2::Require';
sub HAVE_WIDGETS { ... };
sub skip {
my $class = shift;
my @import_args = @_;
if (HAVE_WIDGETS()) {
# We have widgets, do not skip
return undef;
}
else {
# No widgets, skip the test
return "Skipped because there are no widgets" unless HAVE_WIDGETS();
}
}
1;
A subclass of L<Test2::Require> simply needs to implement a C<skip()> method.
This method will receive all import arguments. This method should return undef
if the test should run, and should return a reason for skipping if the test
should be skipped.
=head2 STAND-ALONE
If you do not wish to subclass L<Test2::Require> then you should write an
C<import()> method:
package Test2::Require::Widget;
use strict;
use warnings;
use Test2::API qw/context/;
sub HAVE_WIDGETS { ... };
sub import {
my $class = shift;
# Have widgets, should run.
return if HAVE_WIDGETS();
# Use the context object to create the event
my $ctx = context();
$ctx->plan(0, SKIP => "Skipped because there are no widgets");
$ctx->release;
}
1;
=head1 SOURCE
The source code repository for Test2-Suite can be found at
F<https://github.com/Test-More/Test2-Suite/>.
=head1 MAINTAINERS
=over 4
=item Chad Granum E<lt>[email protected]<gt>
=back
=head1 AUTHORS
=over 4
=item Chad Granum E<lt>[email protected]<gt>
=back
=head1 COPYRIGHT
Copyright 2018 Chad Granum E<lt>[email protected]<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See F<http://dev.perl.org/licenses/>
=cut
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| API | Folder | 0755 |
|
|
| AsyncSubtest | Folder | 0755 |
|
|
| Bundle | Folder | 0755 |
|
|
| Compare | Folder | 0755 |
|
|
| Event | Folder | 0755 |
|
|
| EventFacet | Folder | 0755 |
|
|
| Formatter | Folder | 0755 |
|
|
| Hub | Folder | 0755 |
|
|
| IPC | Folder | 0755 |
|
|
| Manual | Folder | 0755 |
|
|
| Plugin | Folder | 0755 |
|
|
| Require | Folder | 0755 |
|
|
| Tools | Folder | 0755 |
|
|
| Util | Folder | 0755 |
|
|
| Workflow | Folder | 0755 |
|
|
| API.pm | File | 48.43 KB | 0644 |
|
| AsyncSubtest.pm | File | 19.08 KB | 0644 |
|
| Bundle.pm | File | 1.52 KB | 0644 |
|
| Compare.pm | File | 11.53 KB | 0644 |
|
| Event.pm | File | 22.11 KB | 0644 |
|
| EventFacet.pm | File | 1.46 KB | 0644 |
|
| Formatter.pm | File | 3.86 KB | 0644 |
|
| Hub.pm | File | 22.31 KB | 0644 |
|
| IPC.pm | File | 3.1 KB | 0644 |
|
| Manual.pm | File | 1.49 KB | 0644 |
|
| Mock.pm | File | 22.27 KB | 0644 |
|
| Plugin.pm | File | 1.83 KB | 0644 |
|
| Require.pm | File | 2.65 KB | 0644 |
|
| Suite.pm | File | 9.26 KB | 0644 |
|
| Todo.pm | File | 3.77 KB | 0644 |
|
| Tools.pm | File | 2.51 KB | 0644 |
|
| Transition.pod | File | 13.17 KB | 0644 |
|
| Util.pm | File | 10.33 KB | 0644 |
|
| V0.pm | File | 11.56 KB | 0644 |
|
| Workflow.pm | File | 7.13 KB | 0644 |
|