Skip to content

Commit

Permalink
We now do a full run with complete comparison against the saved templ…
Browse files Browse the repository at this point in the history
…ate (closes #17)
  • Loading branch information
stevieb9 committed Dec 24, 2020
1 parent 2dbdda3 commit 0ea1601
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Revision history for STEVEB-Dist-Mgr
roadmap for a binary script
- We now croak() if the new version sent into bump_version() is less
than or equal to the current version (closes #14)
- Add tests that compare a full run against a saved template
distribution (closes #17)

0.04 2020-12-23
- Last test CPAN release
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ t/35-git_ignore.t
t/40-remove_unwanted_files.t
t/45-init.t
t/50-move_distribution_files.t
t/55-full_run.t
t/55-full_run_template_comparison.t
t/data/module_template/.github/workflows/github_ci_default.yml
t/data/module_template/Changes
t/data/module_template/lib/Test/Module.pm
Expand Down
35 changes: 33 additions & 2 deletions t/55-full_run.t → t/55-full_run_template_comparison.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use strict;

use Cwd qw(getcwd);
use Data::Dumper;
use File::Find::Rule;
use File::Find;
use Test::More;
use Hook::Output::Tiny;
Expand Down Expand Up @@ -118,6 +119,38 @@ remove_init();
"$new_ver is greater than $orig_ver ok"
);

# Compare all files against the saved template

my $template_dir = "$cwd/t/data/module_template/";

my @template_files = File::Find::Rule->file()
->name('*')
->in($template_dir);

my $file_count = 0;

for my $tf (@template_files) {
(my $nf = $tf) =~ s/$template_dir//;

if (-f $nf) {
open my $tfh, '<', $tf or die $!;
open my $nfh, '<', $nf or die $!;

my @tf = <$tfh>;
my @nf = <$nfh>;

close $tfh;
close $nfh;

for (0 .. $#tf) {
is $tf[$_], $nf[$_], "$nf file matches the template ok";
}
$file_count++;
}
}

is scalar @template_files, $file_count, "file count matches number of files in template";

# Cleanup

after();
Expand Down Expand Up @@ -146,8 +179,6 @@ sub after {
chdir $cwd or die $!;
like getcwd(), qr/steveb-dist-mgr/, "back in root directory ok";
}
sub check_and_change_into_module_dir {
}
sub file_count {
my ($expected_count) = @_;
my $fs_entry_count;
Expand Down

0 comments on commit 0ea1601

Please sign in to comment.