File: 93_chars.t

package info (click to toggle)
libtext-undiacritic-perl 0.07-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 148 kB
  • sloc: perl: 284; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
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
39
40
41
42
43
44
#!/usr/bin/perl

use strict;
use warnings;

use File::Find;
use Test::More;

if ( not $ENV{TEST_AUTHOR} ) {
    my $msg =
        'Author test. Set (export) $ENV{TEST_AUTHOR} to a true value to run.';
    plan( skip_all => $msg );
}

my %LIST;
find(
    sub {
        if ( $File::Find::name =~
            m{ (lib [/] Text [/] [A-Za-z0-9_/-]+ [.]pm) $ }xms
        ) {
                $LIST{"../$1"} = 1;
            }
    },
    ('../lib'),
);

plan ( tests => (scalar keys %LIST) );

for my $module (sort keys %LIST) {
    open( my $file, '<', $module ) or die "cannnot open file $module";
    local $/;
    my $text = <$file>;

        ok( (
            1
            && ( $text !~ m{[\x0D]}g )          # DOS line ending (CR)
            && ( $text !~ m{[\x09]}g )          # TAB
            && ( $text !~ m{[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\xFF]}g ) # shit
            && ( $text !~ m{[ ][\x0D\x0A]}g )   # trailing space
            ),
            "$module sane characters"
        );
}