aboutsummaryrefslogtreecommitdiffstats
path: root/t/fatal.t
blob: 46389837ac5afad0a7ec8cffce4802801afbf3ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

use strict;
use Test::More tests => 8;
use URPM;

my $u = URPM->new;

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 read synthesis file non-existent/, 'fatal error on synthesis not found' );
is( $! + 0, $!{ENOENT}, '$! is ENOENT' );

my $v = URPM->new( 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' );