⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 metadata2.t

📁 source of perl for linux application,
💻 T
字号:
#!/usr/bin/perl -wuse strict;use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';use MBTest tests => 18;use Cwd ();my $cwd = Cwd::cwd;my $tmp = MBTest->tmpdir;use Module::Build;use Module::Build::ConfigData;use DistGen;############################## ACTION distmeta works without a MANIFEST fileSKIP: {  skip( 'YAML_support feature is not enabled', 4 )      unless Module::Build::ConfigData->feature('YAML_support');  my $dist = DistGen->new( dir => $tmp, skip_manifest => 1 );  $dist->regen;  chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";  ok ! -e 'MANIFEST';  my $mb = Module::Build->new_from_context;  my $out;  $out = eval { stderr_of(sub{$mb->dispatch('distmeta')}) };  is $@, '';  like $out, qr/Nothing to enter for 'provides'/;  ok -e 'META.yml';  chdir( $cwd ) or die "Can''t chdir to '$cwd': $!";  $dist->remove;}############################## Check generation of README file# TODO: We need to test faking the absence of Pod::Readme when present#       so Pod::Text will be used. Also fake the absence of both to#       test that we fail gracefully.my $provides; # Used a bunch of times belowmy $pod_text = <<'---'; =pod=head1 NAMESimple - A simple module =head1 AUTHORSimple Simon <simon@simple.sim>=cut---my $dist = DistGen->new( dir => $tmp );$dist->change_build_pl({    module_name         => $dist->name,    dist_version        => '3.14159265',    license             => 'perl',    create_readme       => 1,});$dist->regen;chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";# .pm File with pod#$dist->change_file( 'lib/Simple.pm', <<'---' . $pod_text);package Simple;$VERSION = '1.23';---$dist->regen( clean => 1 );ok( -e "lib/Simple.pm", "Creating Simple.pm" );my $mb = Module::Build->new_from_context;$mb->do_create_readme;like( slurp("README"), qr/NAME/,     "Generating README from .pm");is( $mb->dist_author->[0], 'Simple Simon <simon@simple.sim>',     "Extracting AUTHOR from .pm");is( $mb->dist_abstract, "A simple module",     "Extracting abstract from .pm");# .pm File with pod in separate file#$dist->change_file( 'lib/Simple.pm', <<'---');package Simple;$VERSION = '1.23';---$dist->change_file( 'lib/Simple.pod', $pod_text );$dist->regen( clean => 1 );ok( -e "lib/Simple.pm", "Creating Simple.pm" );ok( -e "lib/Simple.pod", "Creating Simple.pod" );$mb = Module::Build->new_from_context;$mb->do_create_readme;like( slurp("README"), qr/NAME/, "Generating README from .pod");is( $mb->dist_author->[0], 'Simple Simon <simon@simple.sim>',     "Extracting AUTHOR from .pod");is( $mb->dist_abstract, "A simple module",     "Extracting abstract from .pod");# .pm File with pod and separate pod file #$dist->change_file( 'lib/Simple.pm', <<'---' );package Simple;$VERSION = '1.23';=pod=head1 DONT USE THIS FILE FOR POD=cut---$dist->change_file( 'lib/Simple.pod', $pod_text );$dist->regen( clean => 1 );ok( -e "lib/Simple.pm", "Creating Simple.pm" );ok( -e "lib/Simple.pod", "Creating Simple.pod" );$mb = Module::Build->new_from_context;$mb->do_create_readme;like( slurp("README"), qr/NAME/, "Generating README from .pod over .pm");is( $mb->dist_author->[0], 'Simple Simon <simon@simple.sim>',    "Extracting AUTHOR from .pod over .pm");is( $mb->dist_abstract, "A simple module",    "Extracting abstract from .pod over .pm");############################################################# cleanupchdir( $cwd ) or die "Can't chdir to '$cwd': $!";$dist->remove;use File::Path;rmtree( $tmp );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -