Revision history for MooseX-Types-Path-Class
+0.06 unreleased
+
+ * added ExistingFile and ExistingDir types (jrockway)
+
0.05 Tue Oct 21 2008
* use class_type()
t/01.basic.t
t/02.getopt.t
t/03.subtype.t
-t/kwalitee.t
-t/perlcritic.t
-t/pod-coverage.t
-t/pod.t
+xt/kwalitee.t
+xt/perlcritic.t
+xt/pod-coverage.t
+xt/pod.t
use warnings FATAL => 'all';
use strict;
use inc::Module::Install 0.75;
+use Module::Install::ExtraTests;
name 'MooseX-Types-Path-Class';
all_from 'lib/MooseX/Types/Path/Class.pm';
requires 'Path::Class' => '0.16';
# things the tests need
-build_requires 'Test::More' => '0.62';
+test_requires 'Test::More' => '0.88';
+test_requires 'Test::Exception' => '0.27';
#auto_provides;
#auto_install;
+extra_tests();
+
WriteAll;
+
+{
+
+ package Bar;
+ use Moose;
+ use MooseX::Types::Path::Class qw( ExistingDir ExistingFile );
+
+ has 'dir' => (
+ is => 'ro',
+ isa => ExistingDir,
+ coerce => 1,
+ );
+
+ has 'file' => (
+ is => 'ro',
+ isa => ExistingFile,
+ coerce => 1,
+ );
+}
+
+package main;
+
use strict;
use warnings;
use Test::More;
+use Test::Exception;
+
+my $no_exist = '/should/not/exist';
plan skip_all => "Preconditions failed; your filesystem is strange"
- unless -d "/etc" && -e "/etc/passwd";
+ unless -d "/etc" && -e "/etc/passwd";
+
+plan skip_all => "Preconditions failed"
+ if -e $no_exist;
use MooseX::Types::Path::Class qw(ExistingFile ExistingDir);
ok is_ExistingDir(to_ExistingDir("/etc/")), '/etc/ is an existing directory';
+throws_ok { Bar->new( dir => $no_exist ); }
+ qr/Directory .* must exist/, 'no exist dir throws';
+throws_ok { Bar->new( file => "$no_exist/either" ); }
+ qr/File .* must exist/, 'no exist file throws';
+
done_testing;
+
+++ /dev/null
-
-use warnings FATAL => 'all';
-use strict;
-use Test::More;
-if ( not $ENV{TEST_AUTHOR} ) {
- my $msg
- = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
- plan( skip_all => $msg );
-}
-eval { require Test::Kwalitee; Test::Kwalitee->import() };
-plan( skip_all => 'Test::Kwalitee not installed; skipping' ) if $@;
-
+++ /dev/null
-#!perl
-
-use warnings FATAL => 'all';
-use strict;
-use File::Spec;
-use Test::More;
-
-if ( not $ENV{TEST_AUTHOR} ) {
- my $msg
- = 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.';
- plan( skip_all => $msg );
-}
-
-eval { require Test::Perl::Critic; };
-if ($@) {
- my $msg = 'Test::Perl::Critic required to criticise code';
- plan( skip_all => $msg );
-}
-
-#my $rcfile = File::Spec->catfile( 't', 'perlcriticrc' );
-#Test::Perl::Critic->import( -profile => $rcfile );
-#all_critic_ok();
-Test::Perl::Critic::all_critic_ok();
-
+++ /dev/null
-#!perl
-
-use warnings FATAL => 'all';
-use strict;
-use Test::More;
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all =>
- "Test::Pod::Coverage 1.04 required for testing POD coverage"
- if ($@);
-all_pod_coverage_ok();
+++ /dev/null
-#!perl
-
-use warnings FATAL => 'all';
-use strict;
-use Test::More;
-eval "use Test::Pod 1.14";
-plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
-all_pod_files_ok();