[libpod-weaver-section-generatesection-perl] 01/01: New upstream version 1.05

Carnë Draug carandraug+dev at gmail.com
Thu Feb 2 11:54:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

carandraug-guest pushed a commit to annotated tag upstream/1.05
in repository libpod-weaver-section-generatesection-perl.

commit 88f110b20d553d6d96733907ded7f3b3b22226b2
Author: Carnë Draug <carandraug+dev at gmail.com>
Date:   Thu Feb 2 11:21:30 2017 +0000

    New upstream version 1.05
---
 Changes                                   |  15 +-
 HACKING                                   |  28 ++++
 LICENSE                                   |   2 +-
 MANIFEST                                  |   6 +-
 META.json                                 |  13 +-
 META.yml                                  |  10 +-
 Makefile.PL                               |  18 ++-
 README                                    | 124 ++++++++++++++++
 README.pod                                | 115 ---------------
 dist.ini                                  |  21 +--
 lib/Pod/Weaver/Section/GenerateSection.pm |  19 ++-
 t/00-compile.t                            |  15 +-
 t/author-eol.t                            |  19 ++-
 t/{author-eol.t => author-mojibake.t}     |  11 +-
 t/author-no-tabs.t                        |   3 +-
 t/basic.t                                 | 236 ++++++++++++++++++++++++++++++
 t/release-mojibake.t                      |  20 ---
 17 files changed, 500 insertions(+), 175 deletions(-)

diff --git a/Changes b/Changes
index e584cf9..8d0c98c 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,21 @@
 Summary of important user-visible changes for Pod::Weaver::Section::GenerateSection
 -----------------------------------------------------------------------------------
 
+1.05      2017-02-01 18:36:14+00:00 Europe/London
+  * Declare missing Dist::Zilla:Plugin::PodWeaver dependency for
+    testsuite.
+  * Fix testsuite for Windows systems (actually, systems with a file
+    separator other than /).
+
+1.04      2017-02-01 15:58:37+00:00 Europe/London
+  * Fix regex in tests for compatibility with perl 5.22.
+
+1.03      2017-01-31 18:36:49+00:00 Europe/London
+  * Explicitly import required modules.
+  * Added test suite.
+
 1.02      2016-07-24 00:13:33+01:00 Europe/London
-  * the use of Moose::Autobox has been removed.
+  * The use of Moose::Autobox has been removed.
 
 1.01      2013-03-27 01:10:59 Europe/Dublin
   * Introduced option to use no heading with a head value of 0 (zero).
diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..ae7f485
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,28 @@
+This file describe the rules to use when hacking this project and it
+is not meant to be included in the distribution.
+
+
+* Making changes
+
+Update the Changes file with each commit that includes user-visible
+changes.  This saves having to check the file at the time of release.
+
+
+* Making a release
+
+`dzil' does a lot of things, and we make use of a series of plugins to
+automatically handle the Changes file and git.  It may not be clear
+what needs to be done, so here's the steps:
+
+1. Make sure the working directory is clean `git status'.
+
+2. Run `dzil test -all'.
+
+3. Edit dist.ini to bump the version number.  Do not commit.  The Git
+plugin will make a single commit that bumps the version number in both
+`Changes' and `dist.ini'.  It will also automatically make a
+lightweight version tag.
+
+4. Run `dzil release'.
+
+5. Run `git push --tags'.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 515f501..350c78b 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-This software is Copyright (c) 2016 by Carnë Draug.
+This software is Copyright (c) 2013-2017 by Carnë Draug.
 
 This is free software, licensed under:
 
diff --git a/MANIFEST b/MANIFEST
index 1555cbc..86a8bcb 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,17 +1,19 @@
 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.020.
 Changes
+HACKING
 LICENSE
 MANIFEST
 META.json
 META.yml
 Makefile.PL
-README.pod
+README
 dist.ini
 lib/Pod/Weaver/Section/GenerateSection.pm
 t/00-compile.t
 t/author-eol.t
+t/author-mojibake.t
 t/author-no-tabs.t
-t/release-mojibake.t
+t/basic.t
 t/release-pod-coverage.t
 t/release-pod-syntax.t
 weaver.ini
diff --git a/META.json b/META.json
index 0863986..29da7a3 100644
--- a/META.json
+++ b/META.json
@@ -23,7 +23,8 @@
          "requires" : {
             "Pod::Coverage::TrustPod" : "0",
             "Test::EOL" : "0",
-            "Test::More" : "0",
+            "Test::Mojibake" : "0",
+            "Test::More" : "0.88",
             "Test::NoTabs" : "0",
             "Test::Pod" : "1.41",
             "Test::Pod::Coverage" : "1.08"
@@ -35,6 +36,8 @@
             "Moose" : "0",
             "MooseX::AttributeShortcuts" : "0",
             "MooseX::Types::Moose" : "0",
+            "Pod::Elemental::Element::Nested" : "0",
+            "Pod::Elemental::Element::Pod5::Ordinary" : "0",
             "Pod::Weaver::Role::Section" : "0",
             "namespace::autoclean" : "0",
             "strict" : "0",
@@ -44,10 +47,15 @@
       },
       "test" : {
          "requires" : {
+            "Dist::Zilla::Plugin::GatherDir" : "0",
+            "Dist::Zilla::Plugin::PodWeaver" : "0",
             "File::Spec" : "0",
             "IO::Handle" : "0",
             "IPC::Open3" : "0",
+            "Test::DZil" : "0",
+            "Test::Fatal" : "0",
             "Test::More" : "0",
+            "blib" : "1.01",
             "perl" : "5.006"
          }
       }
@@ -65,7 +73,6 @@
          "web" : "https://github.com/carandraug/pod-weaver-section-generatesection"
       }
    },
-   "version" : "1.02",
-   "x_authority" : "cpan:CDRAUG"
+   "version" : "1.05"
 }
 
diff --git a/META.yml b/META.yml
index b61f86a..dd43adf 100644
--- a/META.yml
+++ b/META.yml
@@ -3,10 +3,15 @@ abstract: 'add pod section from an interpolated piece of text.'
 author:
   - 'Carnë Draug <cdraug at cpan.org>'
 build_requires:
+  Dist::Zilla::Plugin::GatherDir: '0'
+  Dist::Zilla::Plugin::PodWeaver: '0'
   File::Spec: '0'
   IO::Handle: '0'
   IPC::Open3: '0'
+  Test::DZil: '0'
+  Test::Fatal: '0'
   Test::More: '0'
+  blib: '1.01'
   perl: '5.006'
 configure_requires:
   ExtUtils::MakeMaker: '0'
@@ -22,6 +27,8 @@ requires:
   Moose: '0'
   MooseX::AttributeShortcuts: '0'
   MooseX::Types::Moose: '0'
+  Pod::Elemental::Element::Nested: '0'
+  Pod::Elemental::Element::Pod5::Ordinary: '0'
   Pod::Weaver::Role::Section: '0'
   namespace::autoclean: '0'
   strict: '0'
@@ -31,5 +38,4 @@ resources:
   bugtracker: https://github.com/carandraug/pod-weaver-section-generatesection/issues
   homepage: https://github.com/carandraug/pod-weaver-section-generatesection
   repository: git://github.com/carandraug/pod-weaver-section-generatesection.git
-version: '1.02'
-x_authority: cpan:CDRAUG
+version: '1.05'
diff --git a/Makefile.PL b/Makefile.PL
index a568678..3d45b35 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -24,6 +24,8 @@ my %WriteMakefileArgs = (
     "Moose" => 0,
     "MooseX::AttributeShortcuts" => 0,
     "MooseX::Types::Moose" => 0,
+    "Pod::Elemental::Element::Nested" => 0,
+    "Pod::Elemental::Element::Pod5::Ordinary" => 0,
     "Pod::Weaver::Role::Section" => 0,
     "namespace::autoclean" => 0,
     "strict" => 0,
@@ -31,12 +33,17 @@ my %WriteMakefileArgs = (
     "warnings" => 0
   },
   "TEST_REQUIRES" => {
+    "Dist::Zilla::Plugin::GatherDir" => 0,
+    "Dist::Zilla::Plugin::PodWeaver" => 0,
     "File::Spec" => 0,
     "IO::Handle" => 0,
     "IPC::Open3" => 0,
-    "Test::More" => 0
+    "Test::DZil" => 0,
+    "Test::Fatal" => 0,
+    "Test::More" => 0,
+    "blib" => "1.01"
   },
-  "VERSION" => "1.02",
+  "VERSION" => "1.05",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -44,6 +51,8 @@ my %WriteMakefileArgs = (
 
 
 my %FallbackPrereqs = (
+  "Dist::Zilla::Plugin::GatherDir" => 0,
+  "Dist::Zilla::Plugin::PodWeaver" => 0,
   "Dist::Zilla::Role::TextTemplate" => 0,
   "File::Spec" => 0,
   "IO::Handle" => 0,
@@ -51,8 +60,13 @@ my %FallbackPrereqs = (
   "Moose" => 0,
   "MooseX::AttributeShortcuts" => 0,
   "MooseX::Types::Moose" => 0,
+  "Pod::Elemental::Element::Nested" => 0,
+  "Pod::Elemental::Element::Pod5::Ordinary" => 0,
   "Pod::Weaver::Role::Section" => 0,
+  "Test::DZil" => 0,
+  "Test::Fatal" => 0,
   "Test::More" => 0,
+  "blib" => "1.01",
   "namespace::autoclean" => 0,
   "strict" => 0,
   "utf8" => 0,
diff --git a/README b/README
new file mode 100644
index 0000000..428f84b
--- /dev/null
+++ b/README
@@ -0,0 +1,124 @@
+SYNOPSIS
+
+    In your weaver.ini
+
+      [GenerateSection]
+      title = HOMEPAGE
+      text  = This is the POD for distribution {{$name}}. Check out what we have
+      text  = been up to at {{$homepage}}
+
+    The title value can be omited if passed as the plugin name:
+
+      [GenerateSection / HOMEPAGE]
+
+DESCRIPTION
+
+    This plugin attempts to be a cross between
+    Pod::Weaver::Section::Template and Dist::Zilla::Plugin::GenerateFile
+    without the generation of extra files.
+
+    The values of text are concatenated and variable names with matching
+    values on the distribution are interpolated. Specifying the heading
+    level allows one to write down a rather long section of POD text
+    without need for extra files. For example:
+
+      [GenerateSection / FEEDBACK]
+      head = 1
+      [GenerateSection / Reporting bugs]
+      head = 2
+      text = Please report bugs when you find them. While we do have a mailing
+      text = list, please use the bug tracker at {{$bugtracker_web}}
+      text = to report bugs
+      [GenerateSection / Homegape]
+      head = 2
+      text = Also, come check out our other projects at
+      text = {{$homepage}}
+
+    The text to be added to the section. Multiple values are allowed and
+    will be concatenated. Certain sequences on the text will be replaced
+    (see below).
+
+    sub mvp_multivalue_args { return qw(text) } has text => ( is => 'lazy',
+    isa => ArrayRef, default => sub { [] }, );
+
+    The heading level of this section. If 0, there will be no heading.
+    Defaults to 1. =attr title
+
+    The title for this section. It can optionally be omitted and passed as
+    the plugin name. =attr main_module_only
+
+    If true, it will add the text only to the main module POD. Defaults to
+    false. =attr is_template
+
+    If false, it will not attempt to replace the {{}} entries on text.
+    Defaults to true. =head1 Text as template
+
+    Unless the option is_template is false, the text will be run through
+    Text::Template. The variables $plugin, $dist, and $distmeta will be
+    provided, set to the GenerateSection plugin, Dist::Zilla object, and
+    the distribution metadata hash respectively. For convenience, the
+    following variables are also set:
+
+    $name
+
+    $version
+
+    $homepage
+
+    $repository_web
+
+    $repository_url
+
+    $bugtracker_web
+
+    $bugtracker_email
+
+    sub weave_section { my ($self, $document, $input) = @_;
+
+      if ($self->main_module_only) {
+        return if $input->{zilla}->main_module->name ne $input->{filename};
+      }
+    
+      my $text = join ("\n", @{ $self->text });
+      if ($self->is_template) {
+        $text = $self->fill_in_string($text,
+        {
+          dist      => \($input->{zilla}),
+          distmeta  => \($input->{distmeta}),
+          plugin    => \($self),
+    
+          name        => $input->{distmeta}->{name},
+          version     => $input->{distmeta}->{version},
+          homepage    => $input->{distmeta}->{resources}->{homepage},
+          repository_web   => $input->{distmeta}->{resources}->{repository}->{web},
+          repository_url   => $input->{distmeta}->{resources}->{repository}->{url},
+          bugtracker_web   => $input->{distmeta}->{resources}->{bugtracker}->{web},
+          bugtracker_email => $input->{distmeta}->{resources}->{bugtracker}->{mailto},
+        });
+      }
+      $text = Pod::Elemental::Element::Pod5::Ordinary->new({ content => $text });
+      if ($self->head) {
+        $text = Pod::Elemental::Element::Nested->new({
+          command  => "head" . $self->head,
+          content  => $self->title,
+          children => [$text],
+        });
+      }
+      push @{ $document->children }, $text;
+    }
+
+    __PACKAGE__->meta->make_immutable; 1;
+
+POD ERRORS
+
+    Hey! The above document had some coding errors, which are explained
+    below:
+
+    Around line 36:
+
+      Unknown directive: =attr
+
+    Around line 49:
+
+      Unknown directive: =attr
+
diff --git a/README.pod b/README.pod
deleted file mode 100644
index d65b223..0000000
--- a/README.pod
+++ /dev/null
@@ -1,115 +0,0 @@
-=pod
-
-=encoding UTF-8
-
-=head1 NAME
-
-Pod::Weaver::Section::GenerateSection - add pod section from an interpolated piece of text
-
-=head1 VERSION
-
-version 1.02
-
-=head1 SYNOPSIS
-
-In your F<weaver.ini>
-
-  [GenerateSection]
-  title = HOMEPAGE
-  text  = This is the POD for distribution {{$name}}. Check out what we have
-  text  = been up to at {{$homepage}}
-
-The title value can be ommited if passed as the plugin name:
-
-  [GenerateSection / HOMEPAGE]
-
-=head1 DESCRIPTION
-
-This plugin attempts to be a cross between L<Pod::Weaver::Section::Template> and
-L<Dist::Zilla::Plugin::GenerateFile> without the generation of extra files.
-
-The values of text are concatenated and variable names with matching values on
-the distribution are interpolated. Specifying the heading level allows to write
-down a rather long section of POD text without need for extra files. For
-example:
-
-  [GenerateSection / FEEDBACK]
-  head = 1
-  [GenerateSection / Reporting bugs]
-  head = 2
-  text = Please report bugs when you find them. While we do have a mailing
-  text = list, please use the bug tracker at {{$bugtracker_web}}
-  text = to report bugs
-  [GenerateSection / Homegape]
-  head = 2
-  text = Also, come check out our other projects at
-  text = {{$homepage}}
-
-=head1 ATTRIBUTES
-
-=head2 text
-
-The text to be added to the section. Multiple values are allowed and will be
-concatenated. Certain sequences on the text will be replaced (see below).
-
-=head2 head
-
-The heading level of this section. If 0, there will be no heading. Defaults to 1.
-
-=head2 title
-
-The title for this section. It can optionally be omitted and passed as the
-plugin name.
-
-=head2 main_module_only
-
-If true, it will add the text only to the main module POD. Defaults to false.
-
-=head2 is_template
-
-If false, it will not attempt to replace the {{}} entries on text. Defaults to
-true.
-
-=for Pod::Coverage mvp_multivalue_args
-
-=head1 Text as template
-
-Unless the option C<is_template> is false, the text will be run through
-L<Text::Template>.  The variables C<$plugin>, C<$dist>, and C<$distmeta> will be
-provided, set to the GenerateSection plugin, C<Dist::Zilla> object, and the
-distribution metadata hash respectively. For convenience, the following
-variables are also set:
-
-=over
-
-=item $name
-
-=item $version
-
-=item $homepage
-
-=item $repository_web
-
-=item $repository_url
-
-=item $bugtracker_web
-
-=item $bugtracker_email
-
-=back
-
-=for Pod::Coverage weave_section
-
-=head1 AUTHOR
-
-Carnë Draug <cdraug at cpan.org>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2016 by Carnë Draug.
-
-This is free software, licensed under:
-
-  The GNU General Public License, Version 3, June 2007
-
-=cut
diff --git a/dist.ini b/dist.ini
index 7a223d2..0d77616 100644
--- a/dist.ini
+++ b/dist.ini
@@ -1,9 +1,10 @@
 name              = Pod-Weaver-Section-GenerateSection
 abstract          = add pod section from an interpolated piece of text.
-version           = 1.02
+version           = 1.05
 author            = Carnë Draug <cdraug at cpan.org>
 license           = GPL_3
 copyright_holder  = Carnë Draug
+copyright_year    = 2013-2017
 
 [@Filter]
 -bundle = @Basic      ; the basic to maintain and release CPAN distros
@@ -13,13 +14,21 @@ copyright_holder  = Carnë Draug
 [PkgVersion]          ; add a $version to the modules
 [PodSyntaxTests]      ; create a release test for Pod syntax
 [Test::NoTabs]        ; Author tests that ensure hard tabs are not used
-[ReadmeAnyFromPod / ReadmePodInBuild] ; create README from main module POD
-[ReadmeAnyFromPod / ReadmePodInRoot]  ; create README from main module POD
 [Test::Compile]       ; test syntax of all modules
 [PodCoverageTests]    ; create release test for Pod coverage
 [MojibakeTests]       ; create release test for correct encoding
 [AutoPrereqs]         ; automatically find the dependencies
 
+;; These are used in the dist.ini created by the testsuite.  They are
+;; not actually used in the test script so AutoPrereqs misses them.
+[Prereqs / TestRequires]
+Dist::Zilla::Plugin::PodWeaver = 0
+Dist::Zilla::Plugin::GatherDir = 0
+
+[ReadmeFromPod]
+type = text
+readme = README
+
 [AutoMetaResources]   ; automatically fill resources fields on metadata
 repository.github     = user:carandraug
 bugtracker.github     = user:carandraug
@@ -27,10 +36,6 @@ bugtracker.github     = user:carandraug
 homepage              = https://github.com/carandraug/pod-weaver-section-generatesection
 bugtracker.mailto     = cdraug at cpan.org
 
-[Authority]           ; put the $AUTHORITY line in the modules and metadata
-authority             = cpan:CDRAUG
-do_metadata           = 1
-
 [Test::EOL]           ; Author tests making sure correct line endings are used
 trailing_whitespace   = 1
 
@@ -41,11 +46,9 @@ trailing_whitespace   = 1
 ; not yet able to deal with bundles that accept multiple values
 [Git::Check]
 allow_dirty = Changes
-allow_dirty = README.pod
 allow_dirty = dist.ini
 [Git::Commit]
 allow_dirty = Changes
-allow_dirty = README.pod
 allow_dirty = dist.ini
 commit_msg  = release of version %v
 [Git::Tag]
diff --git a/lib/Pod/Weaver/Section/GenerateSection.pm b/lib/Pod/Weaver/Section/GenerateSection.pm
index bc0aeef..5b7248f 100644
--- a/lib/Pod/Weaver/Section/GenerateSection.pm
+++ b/lib/Pod/Weaver/Section/GenerateSection.pm
@@ -1,9 +1,8 @@
 package Pod::Weaver::Section::GenerateSection;
-our $AUTHORITY = 'cpan:CDRAUG';
-$Pod::Weaver::Section::GenerateSection::VERSION = '1.02';
+$Pod::Weaver::Section::GenerateSection::VERSION = '1.05';
 use utf8;
 
-## Copyright (C) 2013-2016 Carnë Draug <carandraug+dev at gmail.com>
+## Copyright (C) 2013-2017 Carnë Draug <carandraug+dev at gmail.com>
 ##
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -20,9 +19,13 @@ use utf8;
 
 use strict;
 use warnings;
+
 use Moose;
 use MooseX::AttributeShortcuts;
 use MooseX::Types::Moose qw(ArrayRef Bool Int Str);
+use Pod::Elemental::Element::Nested;
+use Pod::Elemental::Element::Pod5::Ordinary;
+
 with (
   'Pod::Weaver::Role::Section',
   'Dist::Zilla::Role::TextTemplate',
@@ -123,7 +126,7 @@ Pod::Weaver::Section::GenerateSection - add pod section from an interpolated pie
 
 =head1 VERSION
 
-version 1.02
+version 1.05
 
 =head1 SYNOPSIS
 
@@ -134,7 +137,7 @@ In your F<weaver.ini>
   text  = This is the POD for distribution {{$name}}. Check out what we have
   text  = been up to at {{$homepage}}
 
-The title value can be ommited if passed as the plugin name:
+The title value can be omited if passed as the plugin name:
 
   [GenerateSection / HOMEPAGE]
 
@@ -144,8 +147,8 @@ This plugin attempts to be a cross between L<Pod::Weaver::Section::Template> and
 L<Dist::Zilla::Plugin::GenerateFile> without the generation of extra files.
 
 The values of text are concatenated and variable names with matching values on
-the distribution are interpolated. Specifying the heading level allows to write
-down a rather long section of POD text without need for extra files. For
+the distribution are interpolated. Specifying the heading level allows one to
+write down a rather long section of POD text without need for extra files. For
 example:
 
   [GenerateSection / FEEDBACK]
@@ -221,7 +224,7 @@ Carnë Draug <cdraug at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is Copyright (c) 2016 by Carnë Draug.
+This software is Copyright (c) 2013-2017 by Carnë Draug.
 
 This is free software, licensed under:
 
diff --git a/t/00-compile.t b/t/00-compile.t
index fff7df0..9fe2108 100644
--- a/t/00-compile.t
+++ b/t/00-compile.t
@@ -2,7 +2,7 @@ use 5.006;
 use strict;
 use warnings;
 
-# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.056
 
 use Test::More;
 
@@ -16,7 +16,9 @@ my @module_files = (
 
 # no fake home requested
 
-my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
+my @switches = (
+    -d 'blib' ? '-Mblib' : '-Ilib',
+);
 
 use File::Spec;
 use IPC::Open3;
@@ -30,12 +32,19 @@ for my $lib (@module_files)
     # see L<perlfaq8/How can I capture STDERR from an external command?>
     my $stderr = IO::Handle->new;
 
-    my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
+    diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
+            $^X, @switches, '-e', "require q[$lib]"))
+        if $ENV{PERL_COMPILE_TEST_DEBUG};
+
+    my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
     binmode $stderr, ':crlf' if $^O eq 'MSWin32';
     my @_warnings = <$stderr>;
     waitpid($pid, 0);
     is($?, 0, "$lib loaded ok");
 
+    shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
+        and not eval { require blib; blib->VERSION('1.01') };
+
     if (@_warnings)
     {
         warn @_warnings;
diff --git a/t/author-eol.t b/t/author-eol.t
index bf16558..284c0b6 100644
--- a/t/author-eol.t
+++ b/t/author-eol.t
@@ -8,9 +8,22 @@ BEGIN {
 
 use strict;
 use warnings;
-use Test::More;
 
-# generated by Dist::Zilla::Plugin::Test::EOL 0.16
+# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19
+
+use Test::More 0.88;
 use Test::EOL;
 
-all_perl_files_ok({ trailing_whitespace => 1 });
+my @files = (
+    'lib/Pod/Weaver/Section/GenerateSection.pm',
+    't/00-compile.t',
+    't/author-eol.t',
+    't/author-mojibake.t',
+    't/author-no-tabs.t',
+    't/basic.t',
+    't/release-pod-coverage.t',
+    't/release-pod-syntax.t'
+);
+
+eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files;
+done_testing;
diff --git a/t/author-eol.t b/t/author-mojibake.t
similarity index 58%
copy from t/author-eol.t
copy to t/author-mojibake.t
index bf16558..188f7c9 100644
--- a/t/author-eol.t
+++ b/t/author-mojibake.t
@@ -1,3 +1,4 @@
+#!perl
 
 BEGIN {
   unless ($ENV{AUTHOR_TESTING}) {
@@ -6,11 +7,11 @@ BEGIN {
   }
 }
 
+
 use strict;
-use warnings;
-use Test::More;
+use warnings qw(all);
 
-# generated by Dist::Zilla::Plugin::Test::EOL 0.16
-use Test::EOL;
+use Test::More;
+use Test::Mojibake;
 
-all_perl_files_ok({ trailing_whitespace => 1 });
+all_files_encoding_ok();
diff --git a/t/author-no-tabs.t b/t/author-no-tabs.t
index 5744c8e..bdf12bd 100644
--- a/t/author-no-tabs.t
+++ b/t/author-no-tabs.t
@@ -18,8 +18,9 @@ my @files = (
     'lib/Pod/Weaver/Section/GenerateSection.pm',
     't/00-compile.t',
     't/author-eol.t',
+    't/author-mojibake.t',
     't/author-no-tabs.t',
-    't/release-mojibake.t',
+    't/basic.t',
     't/release-pod-coverage.t',
     't/release-pod-syntax.t'
 );
diff --git a/t/basic.t b/t/basic.t
new file mode 100644
index 0000000..8f5f47b
--- /dev/null
+++ b/t/basic.t
@@ -0,0 +1,236 @@
+#!/usr/bin/env perl
+use utf8;
+
+## Copyright (C) 2017 Carnë Draug <carandraug+dev at gmail.com>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use Test::DZil;
+use Test::Fatal;
+
+my @tests = (
+  {
+    name => "default values, title on plugin name",
+    config => <<'ENDCONFIG',
+[GenerateSection / Header Title]
+ENDCONFIG
+    expected => <<'ENDPOD',
+=head1 Header Title
+
+=cut
+ENDPOD
+  },
+  {
+    name => "default values, title as parameter",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = Header Title
+ENDCONFIG
+    expected => <<'ENDPOD',
+=head1 Header Title
+
+=cut
+ENDPOD
+  },
+  {
+    name => "default values with template",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = Header Title
+text = This is package {{$name}} v{{$version}}
+ENDCONFIG
+    expected => <<'ENDPOD',
+=head1 Header Title
+
+This is package Foo-Bar v0.010
+
+=cut
+ENDPOD
+ },
+  {
+    name => "template for resources in metadata",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = Header Title
+text = Name {{$name}}
+text = v{{$version}}
+text = Homepage {{$homepage}}
+text = repo web {{$repository_web}}
+text = repo url {{$repository_url}}
+text = bugtracker url {{$bugtracker_web}}
+text = bugtracker email {{$bugtracker_email}}
+ENDCONFIG
+    dzil_options => [
+      [MetaResources => {
+        'homepage' => 'https://gnu.org/pro',
+        'bugtracker.web' => 'https://not-savannah-please.gnu.org/bugs/',
+        'bugtracker.mailto' => 'bug-project at rt.cpan.org',
+        'repository.url' => 'https://there.com/dude/project',
+        'repository.web' => 'https://hg.gnu.org/hgweb/pro',
+      }],
+    ],
+    expected => <<'ENDPOD',
+=head1 Header Title
+
+Name Foo-Bar
+v0\.010
+Homepage https://gnu\.org/pro
+repo web https://hg\.gnu\.org/hgweb/pro
+repo url https://there\.com/dude/project
+bugtracker url https://not-savannah-please\.gnu\.org/bugs/
+bugtracker email bug-project at rt\.cpan\.org
+
+=cut
+ENDPOD
+ },
+  {
+    name => "disabling template",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = Header Title
+is_template = 0
+text = This is package {{$name}} v{{$version}}
+ENDCONFIG
+    expected => << 'ENDPOD',
+=head1 Header Title
+
+This is package \{\{\$name}} v\{\{\$version}}
+
+=cut
+ENDPOD
+ },
+  {
+    name => "section as header level 2",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = The big lock-out
+head = 2
+text = I ate all your bees.
+ENDCONFIG
+    expected => <<'ENDPOD',
+=head2 The big lock-out
+
+I ate all your bees.
+
+=cut
+ENDPOD
+ },
+  {
+    name => "just text, no header",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = The big lock-out
+head = 0
+text = I ate all your bees.
+ENDCONFIG
+    expected => <<'ENDPOD',
+
+I ate all your bees.
+
+ENDPOD
+ },
+  {
+    name => "multiline text section",
+    config => <<'ENDCONFIG',
+[GenerateSection]
+title = Elephants and Hens
+head = 2
+text = Here is the elephant; he's happy with his balloon.
+text = Oh no! It's gone! Where is it? It's not behind the rhino
+text = Look in the alligator's mouth,
+text = It's not there either!
+text = Ohhhh the Monkey's got it in the tree! He brings it back
+text = They all drink lemonade.
+text = The End!
+ENDCONFIG
+    expected => << 'ENDPOD',
+=head2 Elephants and Hens
+
+Here is the elephant; he's happy with his balloon\.
+Oh no\! It's gone\! Where is it\? It's not behind the rhino
+Look in the alligator's mouth,
+It's not there either\!
+Ohhhh the Monkey's got it in the tree\! He brings it back
+They all drink lemonade\.
+The End\!
+
+=cut
+ENDPOD
+ },
+  {
+    name => "empty lines on text",
+    config => <<'ENDCONFIG',
+[GenerateSection / Header Title]
+text = This is life!
+text =
+text = We suffer, and slave, and expire.
+text = That's it.
+ENDCONFIG
+    expected => <<'ENDPOD',
+=head1 Header Title
+
+This is life\!
+
+We suffer, and slave, and expire.
+That's it.
+
+=cut
+ENDPOD
+  },
+);
+
+my $module_text = <<'END';
+package Foo;
+1;
+END
+
+foreach my $test (@tests)
+  {
+    my $dzil_options = $test->{dzil_options} // [];
+    my $dzil_ini = simple_ini (
+      {name => 'Foo-Bar', version => '0.010'},
+      'GatherDir', # needed for the build to remain after build
+      'PodWeaver', # this is a pod weaver plugin
+      @$dzil_options,
+    );
+
+    subtest $test->{name} => sub
+    {
+      my $tzil = Test::DZil->Builder->from_config (
+        {dist_root => 'does-not-exist'},
+        {
+          add_files => {
+            "source/dist.ini" => $dzil_ini,
+            "source/lib/Foo.pm" => $module_text,
+            "source/Changes" => "",
+            "source/weaver.ini" => $test->{config},
+          },
+        }
+      );
+
+      $tzil->chrome->logger->set_debug (1);
+
+      is (exception { $tzil->build },undef, 'build completes');
+      like ($tzil->slurp_file ("build/lib/Foo.pm"),
+            qr/$test->{expected}/,
+            'correct section generated');
+    }
+  }
+
+done_testing;
diff --git a/t/release-mojibake.t b/t/release-mojibake.t
deleted file mode 100644
index 6e8e09a..0000000
--- a/t/release-mojibake.t
+++ /dev/null
@@ -1,20 +0,0 @@
-#!perl
-
-BEGIN {
-  unless ($ENV{RELEASE_TESTING}) {
-    require Test::More;
-    Test::More::plan(skip_all => 'these tests are for release candidate testing');
-  }
-}
-
-
-use strict;
-use warnings qw(all);
-
-use Test::More;
-
-## no critic (ProhibitStringyEval, RequireCheckingReturnValueOfEval)
-eval q(use Test::Mojibake);
-plan skip_all => q(Test::Mojibake required for source encoding testing) if $@;
-
-all_files_encoding_ok();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libpod-weaver-section-generatesection-perl.git



More information about the Pkg-perl-cvs-commits mailing list