Test-Simple
view release on metacpan or search on metacpan
lib/Test2/V0.pm view on Meta::CPAN
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);
lib/Test2/V1.pm view on Meta::CPAN
unshift @$requested_exports => grep { my $p = prototype($ns->can($_)); $p && $p =~ '&' } $handle->HANDLE_SUBS() if delete $options->{'-x'};
my $exports = $class->_build_exports($handle, $requested_exports);
unless (delete $options->{'-no-T2'}) {
my $h = $handle;
$exports->{$handle_name} = sub() { $h };
}
croak "Unknown option(s): " . join(', ', sort keys %$options) if keys %$options;
strict->import() if $pragmas->{strict};
'warnings'->import() if $pragmas->{warnings};
Test2::Plugin::UTF8->import() if $plugins->{utf8};
Test2::Plugin::ExitSummary->import() if $plugins->{summary};
if (my $set = $plugins->{srand}) {
Test2::Plugin::SRand->import((ref($set) && "$set" ne "$SET") ? $set->{seed} : ());
}
if (my $target = $plugins->{target}) {
Test2::Tools::Target->import_into($caller, $plugins->{target}) unless "$target" eq "$SET";
t/modules/Bundle/Extended.t view on Meta::CPAN
ok(Test2::Plugin::ExitSummary->active, "Exit Summary is loaded");
ok(defined(Test2::Plugin::SRand->seed), "SRand is loaded");
subtest strictures => sub {
local $^H;
my $hbefore = $^H;
Test2::Bundle::Extended->import;
my $hafter = $^H;
my $strict = do { local $^H; strict->import(); $^H };
ok($strict, 'sanity, got $^H value for strict');
ok(!($hbefore & $strict), "strict is not on before loading Test2::Bundle::Extended");
ok(($hafter & $strict), "strict is on after loading Test2::Bundle::Extended");
};
subtest warnings => sub {
local ${^WARNING_BITS};
my $wbefore = ${^WARNING_BITS} || '';
Test2::Bundle::Extended->import;
t/modules/V0.t view on Meta::CPAN
ok(Test2::Plugin::ExitSummary->active, "Exit Summary is loaded");
ok(defined(Test2::Plugin::SRand->seed), "SRand is loaded");
subtest strictures => sub {
local $^H;
my $hbefore = $^H;
Test2::V0->import;
my $hafter = $^H;
my $strict = do { local $^H; strict->import(); $^H };
ok($strict, 'sanity, got $^H value for strict');
ok(!($hbefore & $strict), "strict is not on before loading Test2::V0");
ok(($hafter & $strict), "strict is on after loading Test2::V0");
};
subtest warnings => sub {
local ${^WARNING_BITS};
my $wbefore = ${^WARNING_BITS} || '';
Test2::V0->import;
t/modules/V1.t view on Meta::CPAN
Test2::V1->import('-srand', '-no-T2');
T2->ok(defined(Test2::Plugin::SRand->seed), "SRand is loaded");
};
subtest strictures => sub {
local $^H;
my $hbefore = $^H;
Test2::V1->import('-strict', '-no-T2');
my $hafter = $^H;
my $strict = do { local $^H; strict->import(); $^H };
T2->ok($strict, 'sanity, got $^H value for strict');
T2->ok(!($hbefore & $strict), "strict is not on before loading Test2::V0");
T2->ok(($hafter & $strict), "strict is on after loading Test2::V0");
};
subtest warnings => sub {
local ${^WARNING_BITS};
my $wbefore = ${^WARNING_BITS} || '';
Test2::V1->import('-warnings', '-no-T2');
( run in 1.463 second using v1.01-cache-2.11-cpan-39bf76dae61 )