Permalink
Browse files

added exception test

  • Loading branch information...
xaicron committed Jul 8, 2011
1 parent 6aff637 commit b7d7d2c8d4c890dc583c9e771d829f999cb4c032
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/App/envfile.pm
  2. +5 −0 t/02_load_envfile.t
View
@@ -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
@@ -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.