Skip to content
Browse files

added exception test

  • Loading branch information...
1 parent 6aff637 commit b7d7d2c8d4c890dc583c9e771d829f999cb4c032 @xaicron committed
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/App/envfile.pm
  2. +5 −0 t/02_load_envfile.t
View
2 lib/App/envfile.pm
@@ -20,7 +20,7 @@ sub run {
sub load_envfile {
my ($self, $file) = @_;
- open my $fh, '<', $file or die "$file $!";
+ open my $fh, '<', $file or die "$file: $!\n";
while (defined (my $line = readline $fh)) {
chomp $line;
next if index($line, '#') == 0;
View
5 t/02_load_envfile.t
@@ -90,4 +90,9 @@ FOO = bar
ENV
+subtest 'file not found' => sub {
+ eval { App::envfile->new->load_envfile('foo.bar') };
+ like $@, qr/^foo.bar: No such file or directory/;
+};
+
done_testing;

0 comments on commit b7d7d2c

Please sign in to comment.
Something went wrong with that request. Please try again.