Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make dzil test more generic #138

Open
wants to merge 3 commits into from

3 participants

@shlomif

These two commits allow to specify a different command to run instead of "test" in "make test" or "./Build test".

shlomif added some commits
@shlomif shlomif Improve the Plugin::Pod* documentation.
Add synopses, and references to "dzil test --release".
ce40482
@shlomif shlomif Add testing_command() in ::Role::TestingBase.
This allows to customise the testing command. All existing tests pass, but
the new functionality was not tested.
969e38c
@shlomif shlomif Fixes for the testing_command commit.
1. Remove an "XXX" comment that was copy+pasted.

2. Made the isa more specific - 'ArrayRef[Str]' rather than 'ArrayRef'.

3. init_arg should not be undef.

4. Add an mvp_multivalue_args for making 'testing_command = '
multi-value.
863dc09
@karenetheridge

This looks like an artifact from Dist::Zilla::Role::TextTemplate and should be removed.

@karenetheridge

This commit should be rebased into the previous one.

@karenetheridge

Commits #2 and #3 should be merged together (see other annotations). Also, there should be a test which demonstrates swapping out the test command.

@Leont

This doesn't make sense to me at all. Why would the test command be an attribute of the test_runner? In its current form you can't use it as an attribute in dist.ini anyway, but shouldn't that be some argument to the test method instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 17, 2013
  1. @shlomif

    Improve the Plugin::Pod* documentation.

    shlomif authored
    Add synopses, and references to "dzil test --release".
  2. @shlomif

    Add testing_command() in ::Role::TestingBase.

    shlomif authored
    This allows to customise the testing command. All existing tests pass, but
    the new functionality was not tested.
  3. @shlomif

    Fixes for the testing_command commit.

    shlomif authored
    1. Remove an "XXX" comment that was copy+pasted.
    
    2. Made the isa more specific - 'ArrayRef[Str]' rather than 'ArrayRef'.
    
    3. init_arg should not be undef.
    
    4. Add an mvp_multivalue_args for making 'testing_command = '
    multi-value.
This page is out of date. Refresh to see the latest.
View
3  lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm
@@ -5,6 +5,7 @@ use Moose;
with(
'Dist::Zilla::Role::BuildRunner',
'Dist::Zilla::Role::TestRunner',
+ 'Dist::Zilla::Role::TestingBase',
);
use namespace::autoclean;
@@ -32,7 +33,7 @@ sub test {
my $make = $self->make_path;
$self->build;
- system($make, 'test',
+ system($make, @{$self->testing_command},
( $self->zilla->logger->get_debug ? 'TEST_VERBOSE=1' : () ),
) and die "error running $make test\n";
View
10 lib/Dist/Zilla/Plugin/PodCoverageTests.pm
@@ -6,6 +6,14 @@ with 'Dist::Zilla::Role::PrereqSource';
use namespace::autoclean;
+=head1 SYNOPSIS
+
+ # Add this line to dist.ini
+ [PodCoverageTests]
+
+ # Run this in the command line to test for POD coverage:
+ $ dzil test --release
+
=head1 DESCRIPTION
This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
@@ -19,6 +27,8 @@ documentation can be found, you can add:
=for Pod::Coverage sub_name other_sub this_one_too
+One can run the release tests by invoking C<dzil test --release>.
+
=cut
# Register the release test prereq as a "develop requires"
View
10 lib/Dist/Zilla/Plugin/PodSyntaxTests.pm
@@ -6,6 +6,14 @@ with 'Dist::Zilla::Role::PrereqSource';
use namespace::autoclean;
+=head1 SYNTAX
+
+ # Add this to your dist.ini.
+ [PodSyntaxTests]
+
+ # To test for POD validity, run this in the shell:
+ $ dzil test --release
+
=head1 DESCRIPTION
This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
@@ -15,6 +23,8 @@ following files:
L<Test::Pod> C<1.41> will be added as a C<develop requires> dependency.
+One can run the release tests by invoking C<dzil test --release>.
+
=cut
View
3  lib/Dist/Zilla/Role/BuildPL.pm
@@ -5,6 +5,7 @@ with qw(
Dist::Zilla::Role::InstallTool
Dist::Zilla::Role::BuildRunner
Dist::Zilla::Role::TestRunner
+ Dist::Zilla::Role::TestingBase
);
use namespace::autoclean;
@@ -23,7 +24,7 @@ sub test {
$self->build;
my @testing = $self->zilla->logger->get_debug ? '--verbose' : ();
- system $^X, 'Build', 'test', @testing and die "error running $^X Build test\n";
+ system $^X, 'Build', @{$self->testing_command}, @testing and die "error running $^X Build test\n";
return;
}
View
40 lib/Dist/Zilla/Role/TestingBase.pm
@@ -0,0 +1,40 @@
+package Dist::Zilla::Role::TestingBase;
+# ABSTRACT: Common ground for automated test suites commands
+use Moose::Role;
+
+use namespace::autoclean;
+
+=attr testing_command
+
+This attribute specifies the testing command to use instead of the "test"
+in "./Build test" or "make test". It is an array reference of arguments.
+
+So for example, one can set it to C<runtest> to test using L<Test::Run::CmdLine>.
+
+Defaults to "test".
+=cut
+
+around mvp_multivalue_args => sub {
+ my ($orig, $self) = @_;
+
+ my @start = $self->$orig;
+ return (@start, qw(testing_command));
+};
+
+has testing_command => (
+ is => 'rw',
+ isa => 'ArrayRef[Str]',
+ lazy => 1,
+ default => sub { [ qw( test ) ] },
+);
+
+1;
+
+=head1 DESCRIPTION
+
+This role is a helper for all installers that make use of test suite commands,
+and allows one to specify the L<testing_command> as an arrayref of command-line
+arguments.
+
+=cut
+
Something went wrong with that request. Please try again.