Author: particle
Date: Tue Jan 17 14:27:20 2006
New Revision: 11232

Added:
   trunk/t/distro/file_metadata.t   (contents, props changed)
Modified:
   trunk/MANIFEST
   trunk/runtime/parrot/library/Getopt/Obj.pir   (props changed)
   trunk/t/dynoplibs/dan.t   (contents, props changed)
   trunk/t/dynoplibs/myops.t   (contents, props changed)
   trunk/t/library/getopt_obj.t   (contents, props changed)
   trunk/t/pmc/addrregistry.t   (props changed)
   trunk/t/pmc/bignum.t   (props changed)
   trunk/t/pmc/bound_nci.t   (props changed)
   trunk/t/pmc/closure.t   (props changed)
   trunk/t/pmc/compiler.t   (props changed)
   trunk/t/pmc/continuation.t   (props changed)
   trunk/t/pmc/csub.t   (props changed)
   trunk/t/pmc/default.t   (props changed)
   trunk/t/pmc/deleg_pmc.t   (props changed)
   trunk/t/pmc/enumerate.t   (props changed)
   trunk/t/pmc/exception_handler.t   (props changed)
   trunk/t/pmc/file.t   (props changed)
   trunk/t/pmc/lexinfo.t   (props changed)
   trunk/t/pmc/lexpad.t   (props changed)
   trunk/t/pmc/none.t   (props changed)
   trunk/t/pmc/null.t   (props changed)
   trunk/t/pmc/parrotclass.t   (props changed)
   trunk/t/pmc/parrotinterpreter.t   (props changed)
   trunk/t/pmc/parrotio.t   (props changed)
   trunk/t/pmc/parrotlibrary.t   (props changed)
   trunk/t/pmc/parrotobject.t   (props changed)
   trunk/t/pmc/parrotthread.t   (props changed)
   trunk/t/pmc/perlenv.t   (props changed)
   trunk/t/pmc/perlscalar.t   (props changed)
   trunk/t/pmc/pointer.t   (props changed)
   trunk/t/pmc/random.t   (props changed)
   trunk/t/pmc/retcontinuation.t   (props changed)
   trunk/t/pmc/scalar.t   (props changed)
   trunk/t/pmc/sharedref.t   (props changed)
   trunk/t/pmc/slice.t   (props changed)
   trunk/t/pmc/super.t   (props changed)
   trunk/t/pmc/unmanagedstruct.t   (props changed)
   trunk/t/pmc/version.t   (props changed)
   trunk/t/pmc/vtablecache.t   (props changed)
Log:
tests: file metadata
~ added ~650 tests for file metadata
~ modified file metadata to pass new tests

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Tue Jan 17 14:27:20 2006
@@ -1881,6 +1881,7 @@ t/configure/config_steps.t              
 t/configure/configure.t                           []
 t/configure/data.t                                []
 t/configure/step.t                                []
+t/distro/file_metadata.t                          []
 t/distro/manifest_skip.t                          []
 t/distro/test_file_coverage.t                     []
 t/doc/Parrot_Docs.t                               []

Added: trunk/t/distro/file_metadata.t
==============================================================================
--- (empty file)
+++ trunk/t/distro/file_metadata.t      Tue Jan 17 14:27:20 2006
@@ -0,0 +1,111 @@
+#!perl
+# Copyright: 2006 The Perl Foundation.  All Rights Reserved.
+# $Id$
+
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use File::Find qw( find );
+use File::Basename qw( fileparse );
+use File::Spec::Functions qw( canonpath catdir catfile );
+use Parrot::Config;
+use Parrot::Revision;
+use ExtUtils::Manifest qw( maniread );
+
+
+=head1 NAME
+
+t/distro/file_metadata.t - verify file metadata matches expectations
+
+=head1 SYNOPSIS
+
+       % prove t/distro/file_metadata.t
+
+=head1 DESCRIPTION
+
+Makes sure that file metadata meets our expectations. For example, checks
+include 'all test files have "text/plain" mime-type',
+and 'all "text/plain" files have keyword expansion enabled'.
+
+NOTE: these tests take a B<LONG> time to run.
+
+=cut
+
+## all test files have "text/plain" mime-type
+TEST_MIME: {
+       my $test_dir = 't';
+       my $test_suffix = '.t';
+
+       my @test_files;
+
+
+       # find test files
+       find { no_chdir => 1,
+                       wanted => sub{ files_of_type( [EMAIL PROTECTED], 
$test_suffix ) },
+               } => canonpath catdir( $PConfig{build_dir}, $test_dir );
+
+
+       my @cmd = qw(svn pg svn:mime-type);
+
+       my $msg = "test file has 'text/plain' mime-type";
+       diag $msg;
+
+       is(
+               sub{ my $r = qx(@cmd $_); chomp $r; "$_ ($r)" }->(),
+               "$_ (text/plain)",
+               "$msg ($_)"
+       ) for @test_files;
+} # TEST_MIME
+
+## keyword expansion
+KEYWORD_EXP: {
+       my @all_files;
+
+       diag "this may take a while...";
+
+       # get files listed in MANIFEST
+       @all_files = sort keys %{maniread( catfile $PConfig{build_dir}, 
'MANIFEST' )};
+
+       my @cmd = qw(svn pg svn:mime-type);
+
+       my @plain_files = grep { $_ if qx(@cmd $_) =~ m!text/plain! } 
@all_files;
+       chomp @plain_files;
+
+       @cmd = qw(svn pg svn:keywords);
+
+       my $msg = "'text/plain' file has keyword expansion";
+       diag $msg;
+
+       is(
+               sub{ my $r = qx(@cmd $_); chomp $r; "$_ ($r)" }->(),
+               "$_ (Author Date Id Revision)",
+               "$msg ($_)"
+       ) for @plain_files;
+} # KEYWORD_EXP
+
+
+# remember to change the number of tests :-)
+BEGIN {
+       unless( $Parrot::Revision::svn_entries or `svk ls .` )
+       { plan skip_all => 'not a working copy'; }
+       else
+       { plan 'no_plan' };
+}
+
+
+
+exit;
+
+
+
+sub files_of_type
+{
+       my( $listref, $ext ) = @_;
+
+       return unless -f $File::Find::name
+               && $File::Find::name =~ m/\Q$ext\E$/;
+
+       push @$listref => $File::Find::name;
+}
+

Modified: trunk/t/dynoplibs/dan.t
==============================================================================
--- trunk/t/dynoplibs/dan.t     (original)
+++ trunk/t/dynoplibs/dan.t     Tue Jan 17 14:27:20 2006
@@ -1,6 +1,6 @@
 #! perl

 # Copyright: 2006 The Perl Foundation.  All Rights Reserved.

-# $Id: dan.t 10145 2005-11-23 03:15:23Z jonathan $

+# $Id$

 

 use strict;

 use warnings;


Modified: trunk/t/dynoplibs/myops.t
==============================================================================
--- trunk/t/dynoplibs/myops.t   (original)
+++ trunk/t/dynoplibs/myops.t   Tue Jan 17 14:27:20 2006
@@ -1,6 +1,6 @@
 #! perl

 # Copyright: 2006 The Perl Foundation.  All Rights Reserved.

-# $Id: myops.t 10145 2005-11-23 03:15:23Z jonathan $

+# $Id$

 

 use strict;

 use warnings;


Modified: trunk/t/library/getopt_obj.t
==============================================================================
--- trunk/t/library/getopt_obj.t        (original)
+++ trunk/t/library/getopt_obj.t        Tue Jan 17 14:27:20 2006
@@ -1,6 +1,6 @@
 #!perl
 # Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
-# $Id: getopt_obj.t 10677 2005-12-26 14:05:52Z jisom $
+# $Id$
 
 use strict;
 use warnings;

Reply via email to