File: 99-manifest.t

package info (click to toggle)
libwww-mechanize-shell-perl 0.62-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 588 kB
  • sloc: perl: 3,324; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (9)
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
use strict;
use Test::More;

# Check that MANIFEST and MANIFEST.skip are sane :

use File::Find;
use File::Spec;

my @files = qw( MANIFEST MANIFEST.SKIP );
plan tests => scalar @files * 4
              +1 # MANIFEST existence check
              +1 # MYMETA.* non-existence check
              ;

for my $file (@files) {
  ok(-f $file, "$file exists");
  open my $fh, '<', $file
    or die "Couldn't open $file : $!";
  my @lines = <$fh>;
  is_deeply([grep(/^$/, @lines)],[], "No empty lines in $file");
  is_deeply([grep(/^\s+$/, @lines)],[], "No whitespace-only lines in $file");
  is_deeply([grep(/^\s*\S\s+$/, @lines)],[],"No trailing whitespace on lines in $file");

  if ($file eq 'MANIFEST') {
    chomp @lines;
    is_deeply([grep { s/\s.*//; ! -f } @lines], [], "All files in $file exist")
        or do { diag "$_ is mentioned in $file but doesn't exist on disk" for grep { ! -f } @lines };

    # Exclude some files from shipping
    is_deeply([grep(/^MYMETA\.(yml|json)$/, @lines)],[],"We don't try to ship MYMETA.* $file");
  };

  close $fh;
};