File: 011_abspaths.t

package info (click to toggle)
libfile-util-perl 4.201720-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 840 kB
  • sloc: perl: 4,353; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 682 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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

use strict;
use warnings;
use Test::More tests => 3;
use Test::NoWarnings;
use File::Temp qw( tmpnam );

use lib './lib';
use File::Util;

# check object constructor
my $f = File::Util->new();

my $fn = tmpnam(); # get absolute filename

my $have_perms  = $f->is_writable( $f->return_path( $fn ) );

SKIP: {

   if ( !$have_perms ) {

      skip 'Insufficient permissions to perform IO' => 2;
   }
   elsif ( $^O =~ /solaris|sunos/i ) {

      skip 'Solaris flock is broken' => 2;
   }

   # test write
   is $f->write_file( file => $fn, content => 'JAPH' ), 1,
      'write file with abs path' ;

   is $f->load_file( $fn ), 'JAPH', 'file content matches' ;
}

unlink $fn;

exit;