}
my $import = sub {
- shift;
+ my $class = shift;
my @imports = &_handle_import_args;
@imports = @EXPORT unless @imports;
my $pkg = caller;
no strict 'refs';
*{$pkg."::$_"} = $leaner_stash->{$_};
- } else {
+ } elsif (/^!/ or !exists $more_stash->{$_} or exists $leaner_stash->{$_}) {
push @test_more_imports, $_;
+ } else {
+ # Croak for symbols in Test::More but not in Test::Leaner
+ Exporter::import($class, $_);
}
}
delete $this_stash->{$_} for @default_exports, keys %imported, @not_imported;
}
-Test::More::plan(tests => 8 * @default_exports + 7 + 2);
+Test::More::plan(tests => 9 * @default_exports + 8 + 3);
check_imports();
check_imports([ ], [ 'nonexistent' ]);
}
+{
+ local $@;
+ eval {
+ Test::Leaner->import(import => [ 'use_ok' ]);
+ };
+ Test::More::like($@, qr/^"use_ok" is not exported by the Test::Leaner module/, 'import "use_ok" croaks');
+ check_imports([ ], [ 'use_ok' ]);
+}
+
{
local $@;
eval {
delete $this_stash->{$_} for @default_exports, keys %imported, @not_imported;
}
-Test::More::plan(tests => 8 * @default_exports + 7 + 2);
+Test::More::plan(tests => 9 * @default_exports + 8 + 3);
check_imports();
check_imports([ ], [ 'nonexistent' ]);
}
+{
+ local $@;
+ eval {
+ Test::Leaner->import(import => [ 'use_ok' ]);
+ };
+ Test::More::like($@, qr/^"use_ok" is not exported by the Test::Leaner module/, 'import "use_ok" croaks');
+ check_imports([ ], [ 'use_ok' ]);
+}
+
{
local $@;
eval {