Skip to content

Commit

Permalink
rewrite test script for Test::ModuleVersion version up and added prer…
Browse files Browse the repository at this point in the history
…eq perl v5.10.1
  • Loading branch information
yuki-kimoto committed Feb 15, 2012
1 parent 1250603 commit 6f6137a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
32 changes: 14 additions & 18 deletions t/module.t
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use 5.010001;

=pod
Developer can create this test script by the following command
You can create this script by the following command
perl t/mvt.pl
=cut

# Created by Test::ModuleVersion 0.08

# Created by Test::ModuleVersion 0.09
use Test::More;
use strict;
use warnings;
Expand Down Expand Up @@ -107,7 +109,7 @@ sub main {

use 5.008007;
package Test::ModuleVersion;
our $VERSION = '0.08';
our $VERSION = '0.09';

package
Test::ModuleVersion::Object::Simple;
Expand Down Expand Up @@ -2683,7 +2685,7 @@ use Carp 'croak';
use Data::Dumper;

sub has { __PACKAGE__->Test::ModuleVersion::Object::Simple::attr(@_) }
has comment => '';
has before => '';
has distnames => sub { {} };
has default_ignore => sub { ['Perl', 'Test::ModuleVersion'] };
has ignore => sub { [] };
Expand Down Expand Up @@ -2737,21 +2739,10 @@ sub get_module_url {
}

sub test_script {
my $self = shift;
my ($self, %opts) = @_;

# Code
my $code;

# Comment
my $comment = $self->comment;
$code .= <<"EOS" if $comment;
=pod
$comment
=cut
EOS
my $code = $self->before . "\n";

# Reffer this module
$code .= "# Created by Test::ModuleVersion $Test::ModuleVersion::VERSION\n";
Expand Down Expand Up @@ -2856,6 +2847,11 @@ EOS
my $privates_code = Data::Dumper->new([$self->privates])->Terse(1)->Indent(2)->Dump;
$code =~ s/<%%%%%% privates %%%%%%>/$privates_code/e;

if (my $file = $opts{output}) {
open my $fh, '>', $file
or die qq/Can't open file "$file": $!/;
print $fh $code;
}
return $code;
}

Expand Down
11 changes: 9 additions & 2 deletions t/mvt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@

# Create module test
my $tm = Test::ModuleVersion->new;
$tm->comment(<<'EOS');
Developer can create this test script by the following command
$tm->before(<<'EOS');
use 5.010001;
=pod
You can create this script by the following command
perl t/mvt.pl
=cut
EOS
$tm->lib(['../extlib/lib/perl5']);
$tm->modules([
Expand Down

0 comments on commit 6f6137a

Please sign in to comment.