Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test %E & %U format codes in NextRelease

  • Loading branch information...
commit d6906159ec0c68e74d327f9d5c3c0a7da24df3a3 1 parent 59f6793
@madsen madsen authored
Showing with 83 additions and 0 deletions.
  1. +83 −0 t/plugins/nextrelease.t
View
83 t/plugins/nextrelease.t
@@ -212,4 +212,87 @@ END_CHANGES
);
}
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v %U %E", } ],
+ 'FakeRelease',
+ ),
+ },
+ },
+ );
+
+ like(
+ exception { $tzil->build },
+ qr{\QYou must enter your name in the [%User] section\E},
+ "complains about missing name",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v %U <%E>", } ],
+ 'FakeRelease',
+ [ '%User' => { name => 'E.X. Ample',
+ email => 'me@example.com' } ],
+ ),
+ },
+ },
+ );
+
+ is(
+ exception { $tzil->build },
+ undef,
+ "build successfully with name & email",
+ );
+
+ like(
+ $tzil->slurp_file('build/Changes'),
+ qr{^0\.001 E\.X\. Ample <me\@example\.com>}m,
+ "adding name and email works",
+ );
+}
+
+{
+ my $tzil = Builder->from_config(
+ { dist_root => 'corpus/dist/DZT' },
+ {
+ add_files => {
+ 'source/Changes' => $changes,
+ 'source/dist.ini' => simple_ini(
+ 'GatherDir',
+ [ NextRelease => { format => "%v %U <%E>",
+ user_stash => '%Info' } ],
+ 'FakeRelease',
+ [ '%User' => '%Info' => { name => 'E.X. Ample',
+ email => 'me@example.com' } ],
+ ),
+ },
+ },
+ );
+
+ is(
+ exception { $tzil->build },
+ undef,
+ "build successfully with %Info stash",
+ );
+
+ like(
+ $tzil->slurp_file('build/Changes'),
+ qr{^0\.001 E\.X\. Ample <me\@example\.com>}m,
+ "adding name and email from %Info works",
+ );
+}
+
done_testing;
Please sign in to comment.
Something went wrong with that request. Please try again.