[Moose-commits] r7199 - / File-Stat-Moose/trunk File-Stat-Moose/trunk/lib/File/Stat File-Stat-Moose/trunk/xt

dexter at code2.0beta.co.uk dexter at code2.0beta.co.uk
Tue Dec 30 15:18:46 GMT 2008


Author: dexter
Date: 2008-12-30 07:18:45 -0800 (Tue, 30 Dec 2008)
New Revision: 7199

Added:
   File-Stat-Moose/trunk/xt/consistent_version_numbers.t
   File-Stat-Moose/trunk/xt/copyright.t
   File-Stat-Moose/trunk/xt/distribution.t
   File-Stat-Moose/trunk/xt/pod_spell.xt
Modified:
   /
   File-Stat-Moose/trunk/Changes
   File-Stat-Moose/trunk/Incompatibilities
   File-Stat-Moose/trunk/MANIFEST
   File-Stat-Moose/trunk/lib/File/Stat/Moose.pm
Log:
* More authoring tests.



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - 29d9eb4e-40d9-41ff-8cc0-7c34f0377d85:/local:4092
2bebade9-0208-dc11-a4b9-00301b3b29d0:/moose:3042
43f30acf-ffa7-db11-9a50-0007e9671810:/local/moose:11316
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/moose:80747
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local_branches/moose:77172
6e11344b-1d34-40d0-9390-86e97abb4eb4:/local:7106
6e4c252e-09e9-db11-9f04-000c29fd8354:/moose:2283
aefc10fd-5b54-4257-b62a-ecea51a09fa3:/local:7227
b9f79518-c350-dc11-a4c1-00c09feb4faf:/moose:2662
cea6dcd6-86ea-db11-b77d-00c09feb4faf:/moose:2218
f7901bf9-e7b5-442b-97a4-4d7fd5798e10:/local/moose:29359
   + 29d9eb4e-40d9-41ff-8cc0-7c34f0377d85:/local:4092
2bebade9-0208-dc11-a4b9-00301b3b29d0:/moose:3042
43f30acf-ffa7-db11-9a50-0007e9671810:/local/moose:11316
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/moose:80747
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local_branches/moose:77172
6e11344b-1d34-40d0-9390-86e97abb4eb4:/local:7383
6e4c252e-09e9-db11-9f04-000c29fd8354:/moose:2283
aefc10fd-5b54-4257-b62a-ecea51a09fa3:/local:7227
b9f79518-c350-dc11-a4c1-00c09feb4faf:/moose:2662
cea6dcd6-86ea-db11-b77d-00c09feb4faf:/moose:2218
f7901bf9-e7b5-442b-97a4-4d7fd5798e10:/local/moose:29359

Modified: File-Stat-Moose/trunk/Changes
===================================================================
--- File-Stat-Moose/trunk/Changes	2008-12-30 15:00:21 UTC (rev 7198)
+++ File-Stat-Moose/trunk/Changes	2008-12-30 15:18:45 UTC (rev 7199)
@@ -1,5 +1,5 @@
 ------------------------------------------------------------------------
-0.04 | Piotr Roszatycki <dexter at debian.org> | 2008-12-27
+0.04 | Piotr Roszatycki <dexter at debian.org> | 2008-12-30
 
 Changes:
 

Modified: File-Stat-Moose/trunk/Incompatibilities
===================================================================
--- File-Stat-Moose/trunk/Incompatibilities	2008-12-30 15:00:21 UTC (rev 7198)
+++ File-Stat-Moose/trunk/Incompatibilities	2008-12-30 15:18:45 UTC (rev 7199)
@@ -18,12 +18,12 @@
 
   Was:
   
-  my $st = File::Stat::Moose->new( 'C:\Autoexec.bat' );
+  my $st = File::Stat::Moose->new( file => 'C:\Autoexec.bat' );
   assert_str_equals( '', $st->blksize );
   
   Should be:
 
-  my $st = File::Stat::Moose->new( 'C:\Autoexec.bat' );
+  my $st = File::Stat::Moose->new( file => 'C:\Autoexec.bat' );
   assert_null( $st->blksize );
 
 ------------------------------------------------------------------------

Modified: File-Stat-Moose/trunk/MANIFEST
===================================================================
--- File-Stat-Moose/trunk/MANIFEST	2008-12-30 15:00:21 UTC (rev 7198)
+++ File-Stat-Moose/trunk/MANIFEST	2008-12-30 15:18:45 UTC (rev 7199)
@@ -1,6 +1,6 @@
 Build.PL
 Changes
-eg/stat_passwd.pl
+eg/stat.pl
 Incompatibilities
 lib/Exception/IO.pm
 lib/File/Stat/Moose.pm

Modified: File-Stat-Moose/trunk/lib/File/Stat/Moose.pm
===================================================================
--- File-Stat-Moose/trunk/lib/File/Stat/Moose.pm	2008-12-30 15:00:21 UTC (rev 7198)
+++ File-Stat-Moose/trunk/lib/File/Stat/Moose.pm	2008-12-30 15:18:45 UTC (rev 7199)
@@ -123,11 +123,11 @@
             isa      => 'Maybe[DateTime]',
             lazy     => 1,
             default  => sub {
-                            return '' if not exists $_[0]->{"_${attr}_epoch"};
-                            defined $_[0]->{"_${attr}_epoch"}
-                            ? DateTime->from_epoch( epoch => $_[0]->{"_${attr}_epoch"} )
-                            : undef
-                        },
+                return '' if not exists $_[0]->{"_${attr}_epoch"};
+                defined $_[0]->{"_${attr}_epoch"}
+                ? DateTime->from_epoch( epoch => $_[0]->{"_${attr}_epoch"} )
+                : undef
+            },
             reader   => $attr,
         );
 
@@ -144,7 +144,7 @@
         $self->{follow} ? $self->stat : $self->lstat;
     };
     
-    return;
+    return TRUE;
 };
 
 

Added: File-Stat-Moose/trunk/xt/consistent_version_numbers.t
===================================================================
--- File-Stat-Moose/trunk/xt/consistent_version_numbers.t	                        (rev 0)
+++ File-Stat-Moose/trunk/xt/consistent_version_numbers.t	2008-12-30 15:18:45 UTC (rev 7199)
@@ -0,0 +1,46 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+our $VERSION = '0.999_001';
+
+use File::Find;
+use File::Slurp;
+
+use Test::More qw(no_plan); ## no critic (Bangs::ProhibitNoPlan)
+
+
+my $last_version = undef;
+find({wanted => \&check_version, no_chdir => 1}, 'blib');
+if (! defined $last_version) {
+    ## no critic (RequireInterpolationOfMetachars)
+    fail('Failed to find any files with $VERSION');
+    ## use critic
+} # end if
+
+
+sub check_version {
+    # $_ is the full path to the file
+    return if ! m{blib/script/}xms && ! m{ [.] pm \z}xms;
+
+    my $content = read_file($_);
+
+    # only look at perl scripts, not sh scripts
+    return if m{blib/script/}xms && $content !~ m/\A \#![^\r\n]+?perl/xms;
+
+    my @version_lines = $content =~ m/ ( [^\n]* \$VERSION [^\n]* ) /gxms;
+    if (@version_lines == 0) {
+       fail($_);
+    } # end if
+    foreach my $line (@version_lines) {
+        if (!defined $last_version) {
+            $last_version = shift @version_lines;
+            pass($_);
+        } else {
+            is($line, $last_version, $_);
+        } # end if
+    } # end foreach
+
+    return;
+} # end check_version()

Added: File-Stat-Moose/trunk/xt/copyright.t
===================================================================
--- File-Stat-Moose/trunk/xt/copyright.t	                        (rev 0)
+++ File-Stat-Moose/trunk/xt/copyright.t	2008-12-30 15:18:45 UTC (rev 7199)
@@ -0,0 +1,82 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+our $VERSION = '0.999_001';
+
+use File::Find;
+use File::Slurp;
+use Readonly;
+
+use Test::More qw(no_plan); ## no critic (Bangs::ProhibitNoPlan)
+
+
+Readonly my $LOCALTIME_YEAR_FIELD_NUMBER => 5;
+Readonly my $LOCALTIME_YEAR_OFFSET       => 1900;
+
+
+my $this_year =
+    (localtime)[$LOCALTIME_YEAR_FIELD_NUMBER] + $LOCALTIME_YEAR_OFFSET;
+my $copyrights_found = 0;
+find({wanted => \&check_file, no_chdir => 1}, 'blib');
+foreach ( grep { m/^readme/ixms } read_dir(q<.>) ) {
+    check_file();
+} # end foreach
+
+ok($copyrights_found != 0, 'found a copyright statement');
+
+
+sub check_file {
+    # $_ is the path to a filename, relative to the root of the
+    # distribution
+
+    # Only test plain files
+    return if (! -f $_);
+
+    ## no critic (ProhibitComplexRegexes)
+    # Filter the list of filenames
+    return if not
+        m<
+            ^
+            (?: README.*          # docs
+                |  .*/scripts/[^/]+  # programs
+                |  .*/script/[^/]+   # programs
+                |  .*/bin/[^/]+      # programs
+                |  .*\.(?:
+                            pl        # program ext
+                        |   pm        # module ext
+                        |   html      # doc ext
+                        |   3pm       # doc ext
+                        |   [13]      # doc ext
+                    )
+            )
+            $
+        >xms;
+    ## use critic
+
+    my $content = read_file($_);
+
+    # Note: man pages will fail to match if the correct form of the
+    # copyright symbol is used because the man page translators don't
+    # handle UTF-8.
+    #
+    # For some reason, Vim writes a bad utf8 version of the copyright sign
+    # if I attempt to modify the line.  So, disable the violation.  *sigh*
+    ## no critic (ProhibitEscapedMetacharacters)
+    my @copyright_years = $content =~ m<
+                                       (?: copyright(?:\s\(c\))? | \(c\) )
+                                       \s*
+                                       (?: \d{4} \\? [-,]\s*)?
+                                       (\d{4})
+                                       >gixms;
+    if (0 < grep {$_ ne $this_year} @copyright_years) {
+        fail("$_ copyrights: @copyright_years");
+    } elsif (0 == @copyright_years) {
+        pass("$_, no copyright found");
+    } else {
+        pass($_);
+    } # end if
+
+    return $copyrights_found += @copyright_years;
+} # end check_file()

Added: File-Stat-Moose/trunk/xt/distribution.t
===================================================================
--- File-Stat-Moose/trunk/xt/distribution.t	                        (rev 0)
+++ File-Stat-Moose/trunk/xt/distribution.t	2008-12-30 15:18:45 UTC (rev 7199)
@@ -0,0 +1,9 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+our $VERSION = '0.999_001';
+
+# No POD coverage due to complaints about builtins when using Fatal.
+use Test::Distribution ( distversion => 1, not => 'podcover' );

Added: File-Stat-Moose/trunk/xt/pod_spell.xt
===================================================================
--- File-Stat-Moose/trunk/xt/pod_spell.xt	                        (rev 0)
+++ File-Stat-Moose/trunk/xt/pod_spell.xt	2008-12-30 15:18:45 UTC (rev 7199)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval q{ use Test::Spelling };
+plan skip_all => "Test::Spelling is not installed." if $@;
+
+set_spell_cmd('aspell -a -d en');
+add_stopwords( map { split /[\s\:\-]/ } <DATA> );
+$ENV{LANG} = 'C';
+all_pod_files_spelling_ok('lib');
+
+__DATA__
+blksize
+DateTime
+dev
+ino
+lstat
+nlink
+OO
+rdev
+Roszatycki
+timestamp




More information about the Moose-commits mailing list