rearranging. need to redo with dzil
Todd Hepler [Mon, 26 Mar 2012 20:06:54 +0000 (15:06 -0500)]
Changes
MANIFEST
Makefile.PL
t/04.existing.t
t/kwalitee.t [deleted file]
t/perlcritic.t [deleted file]
t/pod-coverage.t [deleted file]
t/pod.t [deleted file]

diff --git a/Changes b/Changes
index 276eee0..b7d55a7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 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()
index 6d5ab76..299de44 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -16,7 +16,7 @@ t/00.load.t
 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
index cd27b24..c10b11e 100644 (file)
@@ -2,6 +2,7 @@
 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';
@@ -14,11 +15,14 @@ requires 'MooseX::Types'  => '0.04';
 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;
 
index 8292d9c..5d8f63e 100644 (file)
@@ -1,9 +1,37 @@
+
+{
+
+    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);
 
@@ -11,4 +39,10 @@ ok is_ExistingFile(to_ExistingFile("/etc/passwd")), '/etc/passwd is an existing
 
 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;
+
diff --git a/t/kwalitee.t b/t/kwalitee.t
deleted file mode 100644 (file)
index 30f88c8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-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 $@;
-
diff --git a/t/perlcritic.t b/t/perlcritic.t
deleted file mode 100644 (file)
index 134bdfd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!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();
-
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
deleted file mode 100644 (file)
index 20381d2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!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();
diff --git a/t/pod.t b/t/pod.t
deleted file mode 100644 (file)
index 5d9a6be..0000000
--- a/t/pod.t
+++ /dev/null
@@ -1,8 +0,0 @@
-#!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();