File: 100-internal-all-pm-files.t

package info (click to toggle)
libtest-compile-perl 3.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 324 kB
  • sloc: perl: 816; makefile: 2; sh: 1
file content (38 lines) | stat: -rw-r--r-- 1,290 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
#!perl

use strict;
use warnings;

use Test::More;
use Test::Compile::Internal;

my $internal = Test::Compile::Internal->new();

my @files;

@files = $internal->all_pm_files();
is(@files,2,'Found correct number of modules in default location');
like($files[0],qr/lib.Test.Compile.pm/,'Found module: Compile.pm');
like($files[1],qr/lib.Test.Compile.Internal.pm/,'Found module: Internal.pm');

@files = $internal->all_pm_files('t/scripts');
is(@files,4,'Found correct number of modules in t/scripts');
like($files[0],qr/t.scripts.Fail.pm/,'Found module: Module2.pm');
like($files[1],qr/t.scripts.LethalImport.pm/,'Found module: Module2.pm');
like($files[2],qr/t.scripts.Module.pm/,'Found module: Module.pm');
like($files[3],qr/t.scripts.Module2.pm/,'Found module: Module2.pm');

# Try specifying some files rather than directories
my @search = ('t/scripts/failure.pl', 't/scripts/Module.pm');

@files = $internal->all_pm_files($search[0]);
is(scalar @files,0,"didn't find the specific pl file");

@files = $internal->all_pm_files($search[1]);
is(scalar @files,1,"found the specific pm file");

@files = $internal->all_pm_files(@search);
is(scalar @files,1,"only found one specific file");
like($files[0],qr/t.scripts.Module.pm/,'Found specific file: failure.pl');

$internal->done_testing();