File: nonexistent-locale.t

package info (click to toggle)
libdatetime-locale-perl 1%3A1.37-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,856 kB
  • sloc: perl: 225,932; sh: 23; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (3)
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
use strict;
use warnings;
use utf8;

use Test2::V0;
use Test::File::ShareDir::Dist { 'DateTime-Locale' => 'share' };

use DateTime::Locale::Data;
use File::ShareDir qw( dist_dir );

skip_all 'This test requires chmod support'
    if $^O eq 'MSWin32';

my $file
    = File::Spec->catfile( dist_dir('DateTime-Locale'), 'unreadable.pl' );
open my $fh, '>', $file or die $!;
print {$fh} "some content\n" or die $!;
close $fh                    or die $!;

chmod 0000, $file or die $!;

like(
    dies { DateTime::Locale::Data::locale_data('unreadable') },
    qr/No read permission/,
    'got an exception trying to read an unreadable file',
);

done_testing();