]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blobdiff - t/04-fallback-import-arg.t
Report the correct line in import argument tests
[perl/modules/Test-Leaner.git] / t / 04-fallback-import-arg.t
index ee2bbd5ee9e14d8a83b621cfd63dc37131238fe3..6e0c4bf837ae974020455efc49d370a54eea3497 100644 (file)
@@ -38,6 +38,7 @@ my @default_exports = qw<
 >;
 
 sub check_imports {
+ local $Test::Builder::Level = ($Test::Builder::Level || 0) + 1;
  my %imported     = map { $_ => 1 } @{ $_[0] || [] };
  my @not_imported = @{ $_[1] || [] };
  for (@not_imported, grep !$imported{$_}, @default_exports) {
@@ -50,7 +51,7 @@ sub check_imports {
  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();
 
@@ -72,6 +73,15 @@ 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 {