Permalink
Browse files

show usage

  • Loading branch information...
xaicron committed Jul 10, 2011
1 parent fc1b65b commit 86777e365f5ce81ede9e4204a3ae0875886daa67
Showing with 7 additions and 1 deletion.
  1. +1 −0 lib/App/envfile.pm
  2. +6 −1 t/02_load_envfile.t
View
@@ -19,6 +19,7 @@ sub run {
sub load_envfile {
my ($self, $file) = @_;
+ $self->usage unless -f $file;
open my $fh, '<', $file or die "$file: $!\n";
while (defined (my $line = readline $fh)) {
chomp $line;
View
@@ -91,8 +91,13 @@ FOO = bar
ENV
subtest 'file not found' => sub {
+ no warnings 'redefine';
+ *App::envfile::usage = sub {
+ ok "call this method", "call usage";
+ die "oops";
+ };
eval { App::envfile->new->load_envfile('foo.bar') };
- like $@, qr/^foo.bar: No such file or directory/;
+ like $@, qr/oops/;
};
done_testing;

0 comments on commit 86777e3

Please sign in to comment.