File: 42_looselips.t

package info (click to toggle)
libextutils-modulemaker-perl 0.63-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 744 kB
  • sloc: perl: 7,331; makefile: 11
file content (62 lines) | stat: -rw-r--r-- 1,870 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# t/42_looselips.t
use strict;
use warnings;
use Carp;
use File::Spec;
use File::Temp qw(tempdir);
use Test::More tests => 20;
use_ok( 'ExtUtils::ModuleMaker' );
use_ok( 'ExtUtils::ModuleMaker::Licenses::Local' );
use_ok( 'ExtUtils::ModuleMaker::Auxiliary', qw(
    prepare_mockdirs
    basic_file_and_directory_tests
    read_file_string
) );


{
    my ($home_dir, $personal_defaults_dir) = prepare_mockdirs();
    local $ENV{HOME} = $home_dir;

    my ($tdir, $filetext, $license);

    $tdir = tempdir( CLEANUP => 1);
    ok(chdir $tdir, 'changed to temp directory for testing');

    my ($mod);
    my $testmod = 'Beta';
    my @components = ( 'Alpha', $testmod );
    my $module_name = join('::' => @components);
    my $dist_name = join('-' => @components);

    ok( $mod = ExtUtils::ModuleMaker->new(
            NAME           => $module_name,
            COMPACT        => 1,
            LICENSE        => 'looselips',
            COPYRIGHT_YEAR => 1899,
            AUTHOR         => "J E Keenan",
            ORGANIZATION   => "The World Wide Webby",
        ),
        "call ExtUtils::ModuleMaker->new for $dist_name"
    );

    ok($mod->complete_build(), "build files for Alpha::$testmod");

    basic_file_and_directory_tests($dist_name);

    $filetext = read_file_string(File::Spec->catfile($dist_name, 'LICENSE'));
    ok($filetext, 'Able to read LICENSE');

    like($filetext,
        qr/Copyright \(c\) 1899 The World Wide Webby\. All rights reserved\./,
        "correct copyright year and organization"
    );
    ok($license = $mod->get_license(), "license retrieved");
    like($license,
        qr/^={69}\s+={69}.*?={69}\s+={69}.*?={69}\s+={69}/s,
        "formatting for license and copyright found as expected"
    );
}

my $self = ExtUtils::ModuleMaker::Licenses::Local->interact();
isa_ok($self, 'ExtUtils::ModuleMaker::Licenses::Local');