"Fossies" - the Fresh Open Source Software Archive

Member "Module-Build-0.4224/t/script_dist.t" (30 May 2017, 1892 Bytes) of package /linux/privat/Module-Build-0.4224.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl -w
    2 # -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
    3 # vim:ts=8:sw=2:et:sta:sts=2
    4 
    5 use strict;
    6 use lib 't/lib';
    7 use MBTest 'no_plan';
    8 
    9 use DistGen qw(undent);
   10 use CPAN::Meta::YAML;
   11 
   12 blib_load('Module::Build');
   13 blib_load('Module::Build::ConfigData');
   14 
   15 # XXX DistGen shouldn't be assuming module-ness?
   16 my $dist = DistGen->new(dir => MBTest->tmpdir);
   17 $dist->add_file('bin/foo', undent(<<'  ---'));
   18   #!/usr/bin/perl
   19 
   20   package bin::foo;
   21   $VERSION = 0.01;
   22 
   23   =head1 NAME
   24 
   25   foo - does stuff
   26 
   27   =head1 AUTHOR
   28 
   29   A. U. Thor, a.u.thor@a.galaxy.far.far.away
   30 
   31   =cut
   32 
   33   print "hello world\n";
   34   ---
   35 
   36 my %details = (
   37   dist_name => 'bin-foo',
   38   dist_version_from => 'bin/foo',
   39   dist_author => ['A. U. Thor, a.u.thor@a.galaxy.far.far.away'],
   40   dist_version => '0.01',
   41 );
   42 my %meta_provides = (
   43   'foo' => {
   44     file => 'bin/foo',
   45     version => '0.01',
   46   }
   47 );
   48 $dist->change_build_pl({
   49   # TODO need to get all of this data out of the program itself
   50   ! $ENV{EXTRA_TEST} ? (
   51     %details, meta_merge => { provides => \%meta_provides, },
   52   ) : (),
   53   program_name        => 'bin/foo',
   54   license             => 'perl',
   55 });
   56 
   57 # hmm... the old assumption of what a dist looks like is wrong here
   58 $dist->remove_file('lib/Simple.pm'); $dist->regen;
   59 
   60 $dist->chdir_in;
   61 rmdir('lib');
   62 
   63 #system('konsole');
   64 my $mb = Module::Build->new_from_context;
   65 ok($mb);
   66 is($mb->program_name, 'bin/foo');
   67 is($mb->license, 'perl');
   68 is($mb->dist_name, 'bin-foo');
   69 is($mb->dist_version, '0.01');
   70 is_deeply($mb->dist_author,
   71   ['A. U. Thor, a.u.thor@a.galaxy.far.far.away']);
   72 my $result;
   73 stdout_stderr_of( sub { $result = $mb->dispatch('distmeta') } );
   74 ok $result;
   75 
   76 if (eval { require CPAN::Meta; CPAN::Meta->VERSION(2.142060); }) {
   77     my $yml = CPAN::Meta::YAML->read_string(slurp('META.yml'))->[0];
   78     is_deeply($yml->{provides}, \%meta_provides);
   79 }
   80 
   81 $dist->chdir_original if $dist->did_chdir;