Skip to content

Commit

Permalink
import warns when using unknown argument
Browse files Browse the repository at this point in the history
Fixes #45

Enforce 'strict' syntax in import for enabling
strict mode and warn when using an unknown argument
to import.
  • Loading branch information
atoomic authored and geofffranks committed Jun 12, 2020
1 parent 3b217ba commit b20dc7c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/Test/MockModule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ our $STRICT_MODE;
sub import {
my ( $class, @args ) = @_;

$STRICT_MODE = 1 if ( grep { $_ =~ m/strict/i } @args );
foreach my $arg (@args) {
if ( $arg eq 'strict' ) {
$STRICT_MODE = 1;
}
else {
warn "Test::MockModule unknown import option '$arg'";
}
}

return;
}
Expand Down

0 comments on commit b20dc7c

Please sign in to comment.