summaryrefslogtreecommitdiff
path: root/xt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2014-08-08 22:52:09 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2014-08-08 22:52:09 +0000
commit2a051e40a3fc09bba24c335060e8df327d313e55 (patch)
tree4ab817c1ef19de5ef30213d9accb8786b0b69302 /xt
downloadCPAN-Mini-tarball-2a051e40a3fc09bba24c335060e8df327d313e55.tar.gz
Diffstat (limited to 'xt')
-rw-r--r--xt/fake.t52
-rw-r--r--xt/release/changes_has_content.t41
-rw-r--r--xt/release/pod-syntax.t6
3 files changed, 99 insertions, 0 deletions
diff --git a/xt/fake.t b/xt/fake.t
new file mode 100644
index 0000000..1427b46
--- /dev/null
+++ b/xt/fake.t
@@ -0,0 +1,52 @@
+#!perl
+use strict;
+use warnings;
+
+use File::Find::Rule;
+use File::Spec;
+use File::Temp qw(tempdir);
+use CPAN::Mini;
+
+use Test::More;
+
+my $tempdir = tempdir(CLEANUP => 1);
+
+CPAN::Mini->update_mirror(
+ remote => "http://fakecpan.org/fake/minicpan/1.001/cpan",
+ local => $tempdir,
+ log_level => 'fatal',
+);
+
+pass("performed initial mirror");
+
+CPAN::Mini->update_mirror(
+ remote => "http://fakecpan.org/fake/minicpan/1.002/cpan",
+ local => $tempdir,
+ log_level => 'fatal',
+);
+
+pass("performed mirror update");
+
+my @files = File::Find::Rule->file->in($tempdir);
+$_ = File::Spec->abs2rel($_, $tempdir) for @files;
+
+my @want = qw(
+ RECENT
+ authors/01mailrc.txt.gz
+ authors/id/O/OP/OPRIME/Bug-Gold-9.001.tar.gz
+ authors/id/O/OP/OPRIME/CHECKSUMS
+ authors/id/O/OP/OPRIME/XForm-Rollout-1.00.tar.gz
+ authors/id/X/XY/XYZZY/CHECKSUMS
+ authors/id/X/XY/XYZZY/Hall-MtKing-0.01.tar.gz
+ authors/id/X/XY/XYZZY/Y-2.tar.gz
+ modules/02packages.details.txt.gz
+ modules/03modlist.data.gz
+);
+
+is_deeply(
+ [ sort @files ],
+ [ sort @want ],
+ "we end up with just the files we expect",
+);
+
+done_testing;
diff --git a/xt/release/changes_has_content.t b/xt/release/changes_has_content.t
new file mode 100644
index 0000000..c942c33
--- /dev/null
+++ b/xt/release/changes_has_content.t
@@ -0,0 +1,41 @@
+#!perl
+
+use Test::More tests => 2;
+
+note 'Checking Changes';
+my $changes_file = 'Changes';
+my $newver = '1.111016';
+my $trial_token = '-TRIAL';
+
+SKIP: {
+ ok(-e $changes_file, "$changes_file file exists")
+ or skip 'Changes is missing', 1;
+
+ ok(_get_changes($newver), "$changes_file has content for $newver");
+}
+
+done_testing;
+
+# _get_changes copied and adapted from Dist::Zilla::Plugin::Git::Commit
+# by Jerome Quelin
+sub _get_changes
+{
+ my $newver = shift;
+
+ # parse changelog to find commit message
+ open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!";
+ my $changelog = join('', <$fh>);
+ close $fh;
+
+ my @content =
+ grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented
+ split /\n/, $changelog;
+ shift @content; # drop the version line
+
+ # drop unindented last line and trailing blank lines
+ pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ );
+
+ # return number of non-blank lines
+ return scalar @content;
+}
+
diff --git a/xt/release/pod-syntax.t b/xt/release/pod-syntax.t
new file mode 100644
index 0000000..f0468f1
--- /dev/null
+++ b/xt/release/pod-syntax.t
@@ -0,0 +1,6 @@
+#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
+use Test::More;
+use Test::Pod 1.41;
+
+all_pod_files_ok();