File: 01-get.t

package info (click to toggle)
libnet-tftp-perl 0.1901-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 116 kB
  • sloc: perl: 557; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use Test::More;

BEGIN{
        use_ok Net::TFTP;
}

use Test::MockModule;
my $mock_io =  Test::MockModule->new('Net::TFTP::IO', no_auto => 1);
$mock_io->mock('new', 
               sub { open (my $fh, "<", 't/files/source'  ) or die "Can not open t/files/source: $!";
                     return $fh; }
              );



$tftp = Net::TFTP->new("some.host.name", BlockSize => 1024);
my $retval = $tftp->get('somefile','t/files/directory');
is($retval, undef, 'Error handled, no die');
like($tftp->{error}, qr(Can not open t/files/directory), 'Error message');

done_testing;