aboutsummaryrefslogtreecommitdiffstats
path: root/t/fatal.t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-05-06 09:22:51 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-05-06 09:22:51 +0000
commitec5da158151c83d01c297bf229f4d55d3da54032 (patch)
treec97c7c96f35ffe646691a427e1bedc9808fe56fa /t/fatal.t
parent02416c02cb77fdd6ac3c76edb8a070b5f0a6c527 (diff)
downloadperl-URPM-ec5da158151c83d01c297bf229f4d55d3da54032.tar
perl-URPM-ec5da158151c83d01c297bf229f4d55d3da54032.tar.gz
perl-URPM-ec5da158151c83d01c297bf229f4d55d3da54032.tar.bz2
perl-URPM-ec5da158151c83d01c297bf229f4d55d3da54032.tar.xz
perl-URPM-ec5da158151c83d01c297bf229f4d55d3da54032.zip
Add a way to downgrade some errors (file not found) to non-fatal
Diffstat (limited to 't/fatal.t')
-rw-r--r--t/fatal.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/fatal.t b/t/fatal.t
new file mode 100644
index 0000000..5a98286
--- /dev/null
+++ b/t/fatal.t
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 8;
+use URPM;
+
+my $u = new URPM;
+
+eval { $u->parse_hdlist('non-existent'); };
+like( $@, qr/^cannot open hdlist file non-existent/, 'fatal error on hdlist not found' );
+is( $! + 0, $!{EBADF}, '$! is EBADF' );
+eval { $u->parse_synthesis('non-existent'); };
+like( $@, qr/^unable to uncompress synthesis file non-existent/, 'fatal error on synthesis not found' );
+is( $! + 0, $!{ENOENT}, '$! is ENOENT' );
+
+my $v = new URPM( nofatal => 1 );
+
+eval { $v->parse_hdlist('non-existent'); };
+is( $@, '', 'no error on hdlist not found' );
+is( $! + 0, $!{EBADF}, '$! is EBADF' );
+eval { $v->parse_synthesis('non-existent'); };
+is( $@, '', 'no error on synthesis not found' );
+is( $! + 0, $!{ENOENT}, '$! is ENOENT' );