File: provide-order.t

package info (click to toggle)
libmodule-faker-perl 0.027-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 340 kB
  • sloc: perl: 1,231; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (5)
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 => 4;

use Module::Faker::Dist;
use File::Temp ();

my $MFD = 'Module::Faker::Dist';

my $tmpdir = File::Temp::tempdir(CLEANUP => 1);

my $dist = $MFD->from_file('./eg/Provides-Inner-Sorted.yml');

isa_ok($dist, $MFD);

my $dir = $dist->make_dist_dir({ dir => $tmpdir });

my $file = File::Spec->catfile($dir, qw(lib Provides Inner), 'Sorted.pm');

ok(-e $file, "there's a package file");

my @pkg_lines = do {
  open my $fh, '<', $file or die "couldn't open file $file: $!";
  grep { /^package/ } <$fh>;
};

chomp @pkg_lines;
s/^package (.+);/$1/ for @pkg_lines;

is(@pkg_lines, 4, 'there! are! four! lines!');

is_deeply(
  \@pkg_lines,
  [ map { "Provides::Inner::Sorted::$_" } qw(Alfa Charlie Delta Bravo) ],
  "the packages are in the right order",
);