File: handle-corruption.t

package info (click to toggle)
libtest-mockfile-perl 0.037-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 436 kB
  • sloc: perl: 4,110; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl -w

use strict;
use warnings;

use Test2::Bundle::Extended;
use Test2::Tools::Explain;
use Test2::Tools::Exception qw< lives >;
use Test2::Plugin::NoWarnings;
use Test::MockFile;
use IO::Handle;

my $handle = IO::Handle->new();
isa_ok( $handle, 'IO::Handle' );

my $file = Test::MockFile->file( '/foo', '' );
$! = 0;
ok( open( $handle, '<', '/foo' ), 'Succesfully opened file' );
is( "$!",   '', 'No error (string)' );
is( $! + 0, 0,  'No error (code)' );

isa_ok( $handle, 'IO::File' );

$! = 0;
ok( close($handle), 'Successfully closed handle' );
is( "$!",   '', 'No error (string)' );
is( $! + 0, 0,  'No error (code)' );

done_testing();
exit;