File: 03_all_pm_files.t

package info (click to toggle)
libtest-hasversion-perl 0.014-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 154; makefile: 2
file content (34 lines) | stat: -rwxr-xr-x 784 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl

use Test::More tests => 7;

require_ok('Test::HasVersion');

# alias to have a short name
*all_pm_files = \&Test::HasVersion::all_pm_files;

# and here we test &all_pm_files

{
    my @pm_files = all_pm_files();
    is_deeply( \@pm_files, [qw(HasVersion.pm)] );
}

{
    ok( chdir "t/eg", "cd t/eg" );
    my @pm_files = all_pm_files();
    is_deeply( \@pm_files, [qw(A.pm lib/B.pm lib/B/C.pm)] );  # *.pm lib/**/*.pm
    ok( chdir "../..", "cd ../.." );
}

{
    my @pm_files = all_pm_files("t/eg");
    is_deeply( \@pm_files,
        [qw(t/eg/A.pm t/eg/inc/Foo.pm t/eg/lib/B.pm t/eg/lib/B/C.pm )] )
      ;    # every .pm under t/eg
}

{
    my @pm_files = all_pm_files( "t/eg/A.pm", "t/eg/MANIFEST" );
    is_deeply( \@pm_files, [qw(t/eg/A.pm t/eg/MANIFEST)] );
}