r70394 - in /branches/upstream/libtest-autoloader-perl: ./ current/ current/t/ current/tlib/ current/tlib/auto/ current/tlib/auto/EmptyModule/ current/tlib/auto/TestBusted1/ current/tlib/auto/TestBusted2/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Sat Mar 5 09:33:39 UTC 2011


Author: periapt-guest
Date: Sat Mar  5 09:33:31 2011
New Revision: 70394

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70394
Log:
[svn-inject] Installing original source of libtest-autoloader-perl (0.03)

Added:
    branches/upstream/libtest-autoloader-perl/
    branches/upstream/libtest-autoloader-perl/current/
    branches/upstream/libtest-autoloader-perl/current/AutoLoader.pm
    branches/upstream/libtest-autoloader-perl/current/Changes
    branches/upstream/libtest-autoloader-perl/current/MANIFEST
    branches/upstream/libtest-autoloader-perl/current/META.yml
    branches/upstream/libtest-autoloader-perl/current/Makefile.PL
    branches/upstream/libtest-autoloader-perl/current/README
    branches/upstream/libtest-autoloader-perl/current/t/
    branches/upstream/libtest-autoloader-perl/current/t/00basic.t
    branches/upstream/libtest-autoloader-perl/current/tlib/
    branches/upstream/libtest-autoloader-perl/current/tlib/EmptyModule.pm
    branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted1.pm
    branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted2.pm
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/EmptyModule/
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/EmptyModule/autosplit.ix
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted1/
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted1/autosplit.ix
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted2/
    branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted2/autosplit.ix

Added: branches/upstream/libtest-autoloader-perl/current/AutoLoader.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/AutoLoader.pm?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/AutoLoader.pm (added)
+++ branches/upstream/libtest-autoloader-perl/current/AutoLoader.pm Sat Mar  5 09:33:31 2011
@@ -1,0 +1,156 @@
+# (c) Copyright 2005 Neurogen Corporation, all rights reserved.
+package Test::AutoLoader;
+
+use 5.006; # for 'warnings'
+use strict;
+use warnings;
+use Exporter;
+BEGIN{*import = \&Exporter::import};
+use File::Spec;
+use Test::Builder;
+
+our @EXPORT = ('autoload_ok');
+our $VERSION = 0.03;
+
+# Lifted fairly directly from AutoLoader.pm
+my ($is_dosish, $is_epoc,$is_vms, $is_macos);
+BEGIN {
+    $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32';
+    $is_epoc = $^O eq 'epoc';
+    $is_vms = $^O eq 'VMS';
+    $is_macos = $^O eq 'MacOS';
+}
+
+sub autoload_ok {
+    my ($package, at subnames) = @_;
+    my $Test = Test::Builder->new;
+    # initialize the special vars here?  (if we make this part of Test::More)
+    unless ($package) {
+        return $Test->ok(0,"Can't test autoload of empty package")
+    }
+    my $test_label = "Autoload of $package" .
+      (@subnames ? " (listed subroutines)" : " (all files)");
+    (my $pkg = $package) =~ s#::#/#g;
+    my $dirname;
+    my (@ok, at nok);
+
+    if (defined($dirname = $INC{"$pkg.pm"})) {
+        if ($is_macos) {
+            $pkg =~ tr#/#:#;
+            $dirname =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg#s;
+        } else {
+            $dirname =~ s#^(.*)$pkg\.pm\z#$1auto/$pkg#s;
+        }
+    }
+    unless (defined $dirname and -d $dirname && -r _ ) {
+        $Test->ok(0,$test_label);
+        my $diag = "Unable to find valid autoload directory for $package";
+        $diag .= " (perhaps you forgot to load '$package'?)"
+          if !defined $dirname;
+        $Test->diag($diag);
+        return;
+    }
+    my @filenames = map "$_.al", @subnames;
+    if (!@filenames ) {
+        unless (opendir AUTOLOAD, $dirname) {
+            $Test->ok(0,$test_label); 
+            $Test->diag("Can't open $dirname: $!");
+            return;
+        }
+        @filenames = grep /.+\.al\z/, readdir AUTOLOAD;
+        closedir AUTOLOAD or $Test->diag("Unable to close $dirname: $!");
+    }
+
+    foreach my $filename (@filenames) {
+        my $full_path = File::Spec->catfile($dirname,$filename);
+        # also lifted directly from AutoLoader.pm, then tweaked
+        unless ($full_path =~ m|^/|s) {
+            if ($is_dosish && $full_path !~ m{^([a-z]:)?[\\/]}is) {
+                $full_path = "./$full_path";
+            } elsif ($is_epoc && $full_path !~ m{^([a-z?]:)?[\\/]}is) {
+                $full_path = "./$full_path";
+            } elsif ($is_vms) {
+                # XXX todo by VMSmiths
+                $full_path = "./$full_path";
+            } elsif (!$is_macos) {
+                $full_path = "./$full_path";
+            }
+        }
+        local ($@,$!,$?);
+        if (my $ret = do $full_path) {
+            push @ok, $filename;
+        } else {
+            my $err = $!
+              || $@ && "Compile error"
+              || "false return value";
+            push @nok, [$filename,$err];
+        }
+    }
+    if (@nok) {
+        $Test->ok(0,$test_label);
+        $Test->diag(map "    couldn't load $_->[0]: $_->[1]\n", @nok);
+        return 0;
+    } elsif(@ok) {
+        return $Test->ok(1,$test_label);
+    } else {
+        $Test->ok(0,$test_label);
+        $Test->diag("No autoloaded files found");
+        return 0;
+    }
+}
+no warnings 'void';
+"I pass the test.  I will diminish, and go into the West, and remain Galadriel"
+__END__
+
+
+=head1 NAME
+
+Test::AutoLoader - a testing utility for autosplit/autoloaded modules.
+
+=head1 SYNOPSIS
+
+  use Test::AutoLoader;
+  use Test::More tests => 3;
+  
+  use_ok("My::Module"); # from Test::More
+  autoload_ok("My::Module","mysub","sub_two); # test only the listed subs
+  autoload_ok("My::Module"); # tests all '.al' files found for the module
+
+=head1 DESCRIPTION
+
+This single-purpose module attempts to eliminate uncaught syntax
+errors or other obvious goofs in subroutines that are autosplit, and
+hence not looked at by C<perl -c Module.pm>.  Ideally, this module
+will become unnecessary as you reach full coverage of those
+subroutines in your unit tests.  Until that happy day, however, this
+should provide a quick and dirty backstop for embarrassing typos.
+
+Test::AutoLoader is built on Test::Builder, and should interoperate
+smoothly with other such modules (e.g. Test::Simple, Test::More).
+
+=head1 EXPORT
+
+=head2 autoload_ok
+
+Very much like the 'use_ok' subroutine (see L<Test::More>).  If passed
+only a module name, it will find all subroutine definitions in the
+"auto" directory and attempt to compile them.  If passed a list of
+subroutine names, it will look for and attempt to compile those (and only
+those).  Any files that cannot be found (if specified directly), read, and
+compiled will be listed in the diagnostic output for the failed test.
+
+=head1 AUTHOR
+
+Ben Warfield (ben_warfield at nrgn.com)
+
+=head1 COPYRIGHT AND LICENSE
+
+This module is copyright (c) 2005 Neurogen Corporation, Branford,
+Connecticut, USA.  It may be distributed under the terms of the GNU
+General Public License.
+
+=head1 SEE ALSO
+
+L<perl>, L<Test::More>, L<AutoLoader>.
+
+=cut

Added: branches/upstream/libtest-autoloader-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/Changes?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/Changes (added)
+++ branches/upstream/libtest-autoloader-perl/current/Changes Sat Mar  5 09:33:31 2011
@@ -1,0 +1,13 @@
+Revision history for Perl extension Test::AutoLoader.
+
+0.03  Fri Jul 22 01:53:00 2005
+
+	- Fixed minor problems with Makefile.PL and META.yml
+
+0.02  Wed Jul 20 12:58:23 2005
+	- Initial CPAN release
+
+0.01  Wed Jul 13 19:27:07 2005
+	- original version; created by h2xs 1.21 with options
+		-XAn Test::AutoLoader
+

Added: branches/upstream/libtest-autoloader-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/MANIFEST?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/MANIFEST (added)
+++ branches/upstream/libtest-autoloader-perl/current/MANIFEST Sat Mar  5 09:33:31 2011
@@ -1,0 +1,17 @@
+AutoLoader.pm
+Changes
+MANIFEST
+META.yml
+Makefile.PL
+README
+t/00basic.t
+tlib/EmptyModule.pm
+tlib/TestBusted1.pm
+tlib/TestBusted2.pm
+tlib/auto/EmptyModule/autosplit.ix
+tlib/auto/TestBusted1/autosplit.ix
+tlib/auto/TestBusted1/ostrich.al
+tlib/auto/TestBusted2/autosplit.ix
+tlib/auto/TestBusted2/empty.al
+tlib/auto/TestBusted2/no_ready.al
+tlib/auto/TestBusted2/no_worky.al

Added: branches/upstream/libtest-autoloader-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/META.yml?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/META.yml (added)
+++ branches/upstream/libtest-autoloader-perl/current/META.yml Sat Mar  5 09:33:31 2011
@@ -1,0 +1,13 @@
+---
+name: Test-AutoLoader
+version: 0.03
+license: gpl
+requires:
+  File::Spec: 0
+  Test::Builder: 0
+build_requires:
+  Test::Pod: 0.95
+  Test::Tester: 0.08
+no_index:
+  dir:
+    - tlib

Added: branches/upstream/libtest-autoloader-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/Makefile.PL?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/Makefile.PL (added)
+++ branches/upstream/libtest-autoloader-perl/current/Makefile.PL Sat Mar  5 09:33:31 2011
@@ -1,0 +1,11 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'		=> 'Test::AutoLoader',
+    'VERSION_FROM'	=> 'AutoLoader.pm', # finds $VERSION
+    'PREREQ_PM'		=> {Test::Builder=>0},
+    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM => 'AutoLoader.pm', # retrieve abstract from module
+       AUTHOR     => 'Ben Warfield <ben_warfield at nrgn.com>') : ()),
+);

Added: branches/upstream/libtest-autoloader-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/README?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/README (added)
+++ branches/upstream/libtest-autoloader-perl/current/README Sat Mar  5 09:33:31 2011
@@ -1,0 +1,46 @@
+Test/AutoLoader version 0.03
+============================
+
+DESCRIPTION
+
+This single-purpose module attempts to eliminate uncaught syntax
+errors or other obvious goofs in subroutines that are autosplit, and
+hence not looked at by C<perl -c Module.pm>.  Ideally, this module
+will become unnecessary as you reach full coverage of those
+subroutines in your unit tests.  Until that happy day, however, this
+should provide a quick and dirty backstop for embarrassing typos.
+
+Test::AutoLoader is built on Test::Builder, and should interoperate
+smoothly with other such modules (e.g. Test::Simple, Test::More).
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+
+DEPENDENCIES
+
+To run tests using this module, you will need:
+
+  Test::Builder
+  File::Spec
+
+To run the tests *on* this module, you will need:
+
+  Test::More
+  Test::Tester (optional, but required for the real tests)
+  Test::Pod    (optional)
+
+
+COPYRIGHT AND LICENSE
+
+This module and its accompanying files are distributed under the GNU
+General Public License.
+
+Copyright (C) 2005 Neurogen Corporation, Branford, CT, USA.
+

Added: branches/upstream/libtest-autoloader-perl/current/t/00basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/t/00basic.t?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/t/00basic.t (added)
+++ branches/upstream/libtest-autoloader-perl/current/t/00basic.t Sat Mar  5 09:33:31 2011
@@ -1,0 +1,75 @@
+#!/usr/local/bin/perl
+
+my ($NO_TEST_TESTER,$NO_TEST_POD);
+BEGIN {
+    eval "use Test::Tester 0.08;";
+    $NO_TEST_TESTER = $@;
+    eval "use Test::Pod 0.95";
+    $NO_TEST_POD = $@;
+}
+use Test::More tests=>54;
+use POSIX;
+use strict;
+
+use_ok("Test::AutoLoader");
+can_ok("Test::AutoLoader",'autoload_ok');
+SKIP: {
+    skip "Pod test requires Test::Pod 0.95",1 if $NO_TEST_POD;
+    pod_file_ok("AutoLoader.pm");
+}
+
+if ($NO_TEST_TESTER) {
+  SKIP:{ skip "Remaining tests require Test::Tester 0.08", 51}
+    exit(0);
+}
+
+
+require File::Spec;
+
+# test setup:
+unshift @INC, 'tlib';
+require TestBusted1;
+require TestBusted2;
+require EmptyModule;
+
+my @unreadable = (File::Spec->catdir(qw(tlib auto TestBusted1)),
+                  File::Spec->catfile(qw(tlib auto TestBusted2 no_ready.al)));
+my $CAN_CHMOD =  chmod 0000, @unreadable;
+my $file_errors;
+$file_errors .=<<DIAG if $CAN_CHMOD;
+    couldn't load no_ready.al: Permission denied
+DIAG
+$file_errors .= <<DIAG;
+    couldn't load nobody_home.al: No such file or directory
+    couldn't load empty.al: false return value
+DIAG
+
+
+my @tests = (
+  [ ['POSIX'],{ok=>1,name=>"Autoload of POSIX (all files)"},"Standard-distribution module, all files"],
+  [ [qw(POSIX strcpy)],{ok=>1,name=>"Autoload of POSIX (listed subroutines)"},"Standard-distribution module, one file"],
+  [ [qw(POSIX no_such_function)], {ok=>0,diag=>"    couldn't load no_such_function.al: No such file or directory"}, "Standard-distribution, bad subroutine name"],
+  [ [qw(strict)], {ok=>0,diag=>"Unable to find valid autoload directory for strict"}, "Non-existent auto directory"],
+  [ [qw(EmptyModule)], {ok=>0,diag=>"No autoloaded files found"}, "No files in auto directory"],
+  [ [qw(Foo::Bar::Baz)], {ok=>0,diag=>"Unable to find valid autoload directory for Foo::Bar::Baz (perhaps you forgot to load 'Foo::Bar::Baz'?)"}, "Module not loaded"],
+  [ [qw(TestBusted2 no_worky)], {ok=>0,diag=>"    couldn't load no_worky.al: Compile error"}, "Syntax error"],
+  [ [qw(TestBusted2 no_ready nobody_home empty)], {ok=>0,diag=>$file_errors}, "File-reading errors"],
+  [ [qw()], {ok=>0,diag=>"",name=>"Can't test autoload of empty package"}, "Empty arglist"],
+#  [ [qw()], {ok=>0,diag=>""}, "name"],
+
+);
+
+if ($CAN_CHMOD) {
+    push @tests, 
+      [ [qw(TestBusted1)], {ok=>0,diag=>"Unable to find valid autoload directory for TestBusted1"}, "Unreadable auto directory"],
+}
+
+foreach my $test (@tests) {
+    check_test( sub {autoload_ok(@{$test->[0]})},$test->[1],$test->[2])
+}
+
+if ($CAN_CHMOD) {
+    chmod 0755, @unreadable or warn "Couldn't chmod @unreadable back: $!\n";
+} else {
+  SKIP:{skip "Couldn't set up unreadable directory for test",5}
+}

Added: branches/upstream/libtest-autoloader-perl/current/tlib/EmptyModule.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/tlib/EmptyModule.pm?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/tlib/EmptyModule.pm (added)
+++ branches/upstream/libtest-autoloader-perl/current/tlib/EmptyModule.pm Sat Mar  5 09:33:31 2011
@@ -1,0 +1,3 @@
+package EmptyModule;
+use AutoLoader 'AUTOLOAD';
+1;

Added: branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted1.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted1.pm?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted1.pm (added)
+++ branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted1.pm Sat Mar  5 09:33:31 2011
@@ -1,0 +1,3 @@
+package TestBusted1;
+use AutoLoader 'AUTOLOAD';
+1;

Added: branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted2.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted2.pm?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted2.pm (added)
+++ branches/upstream/libtest-autoloader-perl/current/tlib/TestBusted2.pm Sat Mar  5 09:33:31 2011
@@ -1,0 +1,3 @@
+package TestBusted2;
+use AutoLoader 'AUTOLOAD';
+1;

Added: branches/upstream/libtest-autoloader-perl/current/tlib/auto/EmptyModule/autosplit.ix
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/tlib/auto/EmptyModule/autosplit.ix?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/tlib/auto/EmptyModule/autosplit.ix (added)
+++ branches/upstream/libtest-autoloader-perl/current/tlib/auto/EmptyModule/autosplit.ix Sat Mar  5 09:33:31 2011
@@ -1,0 +1,1 @@
+1;

Added: branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted1/autosplit.ix
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted1/autosplit.ix?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted1/autosplit.ix (added)
+++ branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted1/autosplit.ix Sat Mar  5 09:33:31 2011
@@ -1,0 +1,1 @@
+1;

Added: branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted2/autosplit.ix
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted2/autosplit.ix?rev=70394&op=file
==============================================================================
--- branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted2/autosplit.ix (added)
+++ branches/upstream/libtest-autoloader-perl/current/tlib/auto/TestBusted2/autosplit.ix Sat Mar  5 09:33:31 2011
@@ -1,0 +1,1 @@
+1;




More information about the Pkg-perl-cvs-commits mailing list