Sys-OsPackage

 view release on metacpan or  search on metacpan

t/010_fetch_reqs.t  view on Meta::CPAN

#!/usr/bin/perl
# t/010_fetch_reqs.t - test bin/fetch-reqs.pl script
use strict;
use warnings;
use utf8;
use autodie;
use open ':std', ':encoding(utf8)';
use Carp qw(carp croak);
use Readonly;
use Config;
use File::Temp;
use File::Path     qw(make_path);
use File::Basename qw(basename);
use File::Slurp    qw(slurp);
use Cwd            qw(abs_path);

# Initial attempt at these tests in 0.3.0 didn't go over well with CPAN Testers. Container tests
# confirmed their problems but so far haven't found settings that work to capture CPAN build
# outputs both on a desktop CLI and in the the container environment. Re-enable when working...
use Test::More skip_all => 'deactivate these tests until multi-platform issues are fixed';

# configuration & constants
Readonly::Scalar my $script_name => "bin/fetch-reqs.pl";
Readonly::Scalar my $debug_mode  => ( exists $ENV{SYS_OSPACKAGE_DEBUG} and $ENV{SYS_OSPACKAGE_DEBUG} ) ? 1 : 0;
Readonly::Array my @inc_configs => qw(installarchlib installprivlib installvendorlib installsitelib);
Readonly::Scalar my $input_dir         => "t/test-inputs/" . basename( $0, ".t" );
Readonly::Scalar my $tmpdir_template   => "Sys-OsPackage-XXXXXXXXXX";
Readonly::Scalar my $new_dir_perms     => oct('770');
Readonly::Scalar my $new_file_perms    => oct('660');
Readonly::Scalar my $xdg_data_home     => ".local/share";
Readonly::Scalar my $xdg_userdirs_conf => "user-dirs.dirs";
Readonly::Scalar my $cpan_home_subpath => ".cpan";
Readonly::Array my @cpan_home_subdirs => qw(build  CPAN prefs  sources);
Readonly::Scalar my $cpanm_home_subpath => ".cpanm";
Readonly::Array my @local_lib_dedup => qw(PERL5LIB PATH MANPATH);
Readonly::Array my @local_lib_keep  => ( qw(HOME), @local_lib_dedup );
Readonly::Array my @local_lib_clear => qw(PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT);
Readonly::Array my @local_lib_vars  => ( @local_lib_keep, @local_lib_clear );
Readonly::Hash my %tests => (
    existent => {
        'Acme' => {
            files => [
                qw(
                    man/man3/Acme.3pm
                    man/man3/Spiffy.3pm
                    lib/perl5/Acme.pod
                    lib/perl5/Acme.pm
                    lib/perl5/Spiffy.pm
                    lib/perl5/Spiffy.pod
                    lib/perl5/Spiffy/mixin.pm
                )
            ],
        },
        'Acme::Boom' => {
            files => [
                qw(
                    man/man3/Acme::Boom.3pm
                    lib/perl5/Acme/Boom.pm
                )
            ],
        },
        'List::Util::MaybeXS' => {
            files => [
                qw(
                    man/man3/List::Util::MaybeXS.3pm
                    man/man3/List::Util::PP.3pm
                    lib/perl5/List/Util/MaybeXS.pm
                    lib/perl5/List/Util/PP.pm
                )
            ],
        },
    },
    nonexistent => {

        # make up new non-existent module(s) if any get created in CPAN
        # "Smackme" = word play on Acme, except doesn't exist in CPAN
        Smackme => {},
    },
);



( run in 0.830 second using v1.01-cache-2.11-cpan-d8267643d1d )