r8410 - in /branches/upstream/libtest-without-module-perl: ./ current/ current/lib/ current/lib/Test/ current/lib/Test/Without/ current/t/

hanska-guest at users.alioth.debian.org hanska-guest at users.alioth.debian.org
Sun Oct 21 09:27:05 UTC 2007


Author: hanska-guest
Date: Sun Oct 21 09:27:05 2007
New Revision: 8410

URL: http://svn.debian.org/wsvn/?sc=1&rev=8410
Log:
[svn-inject] Installing original source of libtest-without-module-perl

Added:
    branches/upstream/libtest-without-module-perl/
    branches/upstream/libtest-without-module-perl/current/
    branches/upstream/libtest-without-module-perl/current/Changes   (with props)
    branches/upstream/libtest-without-module-perl/current/MANIFEST   (with props)
    branches/upstream/libtest-without-module-perl/current/MANIFEST.skip   (with props)
    branches/upstream/libtest-without-module-perl/current/META.yml
    branches/upstream/libtest-without-module-perl/current/Makefile.PL   (with props)
    branches/upstream/libtest-without-module-perl/current/README   (with props)
    branches/upstream/libtest-without-module-perl/current/lib/
    branches/upstream/libtest-without-module-perl/current/lib/Test/
    branches/upstream/libtest-without-module-perl/current/lib/Test/Without/
    branches/upstream/libtest-without-module-perl/current/lib/Test/Without/Module.pm   (with props)
    branches/upstream/libtest-without-module-perl/current/t/
    branches/upstream/libtest-without-module-perl/current/t/01-api.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/02-block-use-module.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/03-block-require-module.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/04-import-export.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/99-manifest.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/99-pod.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/99-todo.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/99-unix-text.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/99-versions.t   (with props)
    branches/upstream/libtest-without-module-perl/current/t/embedded-Test-Without-Module.t   (with props)

Added: branches/upstream/libtest-without-module-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/Changes?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/Changes (added)
+++ branches/upstream/libtest-without-module-perl/current/Changes Sun Oct 21 09:27:05 2007
@@ -1,0 +1,56 @@
+Revision history for Perl extension Test::Without::Module.
+
+Todo:
+  - Add way to allow only core modules (suggested by SREZIC)
+
+0.14 20071020
+  - Hopefully restored compatibility of the tests with Perl 5.005 this time, reported by SREZIC
+  . No functional changes, no upgrade is necessary
+
+0.13 20071020
+  - Restored compatibility of the tests with Perl 5.005, reported by SREZIC
+  . No functional changes, no upgrade is necessary
+
+0.12 20071020
+  - Fixed RT [rt.cpan.org #24735], reported by Slaven Rezic
+    This seems to have been some really weird interaction or maybe
+    eating of $@.
+
+0.11 20070819
+  - File::Slurp is now no prerequisite anymore - the test
+    requiring it is now optional
+
+0.10 20070804
+  - Added missing File::Slurp prerequisite. Thanks to ANDK and
+    the CPAN smoke testers to alert me to this
+  - No functional changes. No upgrade from 0.09 is necessary.
+
+0.09 20061231
+  - Added more consistency tests
+  - Added Jerrad Pierce to the list of those
+    who mentioned the command line use. I forgot
+    the usage NUFFIN had given, so both were
+    genuinely new to me.
+
+0.08 20061229
+  - Removed superfluous File::Temp usage from module
+
+0.07 20061229
+  - No more inline pod tests
+  - No code changes since 0.06
+
+0.06 20030320
+  - fixed the inline test pod
+  - Now needs Test::Pod 0.95 (or skips the pod test)
+
+0.03 20030217
+  - Released on CPAN
+  - Fixes so the pod for the fake module doesn't appear
+    in the main pod.
+
+0.02 20030216
+  - Released on CPAN
+
+0.01  Sat Feb 15 21:14:45 2003
+  - original version; created by h2xs 1.21 with options
+    -Xn Test::Without::Module

Propchange: branches/upstream/libtest-without-module-perl/current/Changes
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/MANIFEST?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/MANIFEST (added)
+++ branches/upstream/libtest-without-module-perl/current/MANIFEST Sun Oct 21 09:27:05 2007
@@ -1,0 +1,17 @@
+Changes
+Makefile.PL
+MANIFEST
+MANIFEST.skip
+README
+lib/Test/Without/Module.pm
+t/01-api.t
+t/02-block-use-module.t
+t/03-block-require-module.t
+t/04-import-export.t
+t/embedded-Test-Without-Module.t
+t/99-manifest.t
+t/99-pod.t
+t/99-todo.t
+t/99-unix-text.t
+t/99-versions.t
+META.yml                                 Module meta-data (added by MakeMaker)

Propchange: branches/upstream/libtest-without-module-perl/current/MANIFEST
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/MANIFEST.skip
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/MANIFEST.skip?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/MANIFEST.skip (added)
+++ branches/upstream/libtest-without-module-perl/current/MANIFEST.skip Sun Oct 21 09:27:05 2007
@@ -1,0 +1,12 @@
+^.cvsignore
+^.lwpcookies
+^.releaserc
+^blib/
+^Test-Without-Module-.*
+CVS/
+^pm_to_blib
+.tar.gz$
+.old$
+^Makefile$
+^Releases/
+^Texts/

Propchange: branches/upstream/libtest-without-module-perl/current/MANIFEST.skip
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/META.yml?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/META.yml (added)
+++ branches/upstream/libtest-without-module-perl/current/META.yml Sun Oct 21 09:27:05 2007
@@ -1,0 +1,13 @@
+--- #YAML:1.0
+name:                Test-Without-Module
+version:             0.14
+abstract:            Test fallback behaviour in absence of modules
+license:             ~
+generated_by:        ExtUtils::MakeMaker version 6.36_01
+distribution_type:   module
+requires:     
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.2.html
+    version: 1.2
+author:
+    - Max Maischein <corion at cpan.org>

Added: branches/upstream/libtest-without-module-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/Makefile.PL?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/Makefile.PL (added)
+++ branches/upstream/libtest-without-module-perl/current/Makefile.PL Sun Oct 21 09:27:05 2007
@@ -1,0 +1,15 @@
+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::Without::Module',
+    'VERSION_FROM'  => 'lib/Test/Without/Module.pm', # finds $VERSION
+    'PREREQ_PM'    => {
+    #    'File::Slurp' => 0,
+    #    Only needed for testing
+    }, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM => 'lib/Test/Without/Module.pm', # retrieve abstract from module
+       AUTHOR     => 'Max Maischein <corion at cpan.org>') : ()),
+);
+

Propchange: branches/upstream/libtest-without-module-perl/current/Makefile.PL
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/README?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/README (added)
+++ branches/upstream/libtest-without-module-perl/current/README Sun Oct 21 09:27:05 2007
@@ -1,0 +1,12 @@
+Test/Without/Module version 0.03
+================================
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+

Propchange: branches/upstream/libtest-without-module-perl/current/README
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/lib/Test/Without/Module.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/lib/Test/Without/Module.pm?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/lib/Test/Without/Module.pm (added)
+++ branches/upstream/libtest-without-module-perl/current/lib/Test/Without/Module.pm Sun Oct 21 09:27:05 2007
@@ -1,0 +1,166 @@
+package Test::Without::Module;
+use strict;
+use Carp qw( croak );
+
+use vars qw( $VERSION );
+$VERSION = 0.14;
+
+use vars qw( %forbidden );
+
+sub get_forbidden_list {
+  \%forbidden
+};
+
+sub import {
+  my ($self, at forbidden_modules) = @_;
+
+  my $forbidden = get_forbidden_list;
+  $forbidden->{$_} = $_
+    for @forbidden_modules;
+
+  # Scrub %INC, so that loaded modules disappear
+  for my $module (@forbidden_modules) {
+    scrub( $module );
+  };
+
+  unshift @INC, \&fake_module;
+};
+
+sub fake_module {
+    my ($self,$module_file,$member_only) = @_;
+    #warn $@ if $@; # Don't touch $@, or .al files will not load anymore????
+
+    my $forbidden = get_forbidden_list;
+
+    my $modulename = file2module($module_file);
+
+    # Deliver a faked, nonworking module
+    #if (grep { $modulename =~ /\Q$_\E/ } keys %$forbidden) {
+    if (exists $forbidden->{$modulename}) {
+      my @faked_module = ("package $modulename;","0;");
+      return sub { defined ( $_ = shift @faked_module ) };
+    };
+};
+
+sub unimport {
+  my ($self, at list) = @_;
+  my $module;
+  my $forbidden = \%forbidden;
+  for $module (@list) {
+    if (exists $forbidden->{$module}) {
+      delete $forbidden->{$module};
+      scrub( $module );
+    } else {
+      croak "Can't allow non-forbidden module $module";
+    };
+  };
+};
+
+sub file2module {
+  my ($mod) = @_;
+  $mod =~ s!/!::!g;
+  $mod =~ s!\.pm$!!;
+  $mod;
+};
+
+sub scrub {
+  my ($module) = @_;
+  my $key;
+  for $key (keys %INC) {
+    delete $INC{$key}
+      if (file2module($key) =~ /\Q$module\E$/);
+      #if (file2module($key) =~ $module);
+  };
+};
+
+1;
+
+=head1 NAME
+
+Test::Without::Module - Test fallback behaviour in absence of modules
+
+=head1 SYNOPSIS
+
+=for example begin
+
+  use Test::Without::Module qw( My::Module );
+
+  # Now, loading of My::Module fails :
+  eval { require My::Module; };
+  warn $@ if $@;
+
+  # Now it works again
+  eval q{ no Test::Without::Module qw( My::Module ) };
+  eval { require My::Module; };
+  print "Found My::Module" unless $@;
+
+=for example end
+
+=head1 DESCRIPTION
+
+This module allows you to deliberately hide modules from a program
+even though they are installed. This is mostly useful for testing modules
+that have a fallback when a certain dependency module is not installed.
+
+=head2 EXPORT
+
+None. All magic is done via C<use Test::Without::Module LIST> and
+C<no Test::Without::Module LIST>.
+
+=head2 Test::Without::Module::get_forbidden_list
+
+This function returns a reference to a copy of the current hash of forbidden
+modules or an empty hash if none are currently forbidden. This is convenient
+if you are testing and/or debugging this module.
+
+=cut
+
+=head1 ONE LINER
+
+A neat trick for using this module from the command line
+was mentioned to me by NUFFIN:
+
+  perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t
+
+That way, you can easily see how your module or test file behaves
+when a certain module is unavailable.
+
+=head1 BUGS
+
+=over 4
+
+=item * There is no lexicalic scoping
+
+=back
+
+=head1 CREDITS
+
+Much improvement must be thanked to Aristotle from PerlMonks, he pointed me
+to a much less convoluted way to fake a module at
+L<http://www.perlmonks.org/index.pl?node=192635>.
+
+I also discussed with him an even more elegant way of overriding
+CORE::GLOBAL::require, but the parsing of the overridden subroutine
+didn't work out the way I wanted it - CORE::require didn't recognize
+barewords as such anymore.
+
+NUFFIN and Jerrad Pierce pointed out the convenient
+use from the command line to interactively watch the
+behaviour of the test suite and module in absence
+of a module.
+
+=head1 AUTHOR
+
+Copyright (c) 2003-2007 Max Maischein, E<lt>corion at cpan.orgE<gt>
+
+=head1 LICENSE
+
+This module is released under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<Devel::Hide>, L<Acme::Intraweb>, L<PAR>, L<perlfunc>
+
+=cut
+
+__END__

Propchange: branches/upstream/libtest-without-module-perl/current/lib/Test/Without/Module.pm
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/01-api.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/01-api.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/01-api.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/01-api.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,5 @@
+#!/usr/bin/perl -w
+
+use Test::More tests => 1;
+
+use_ok( 'Test::Without::Module' );

Propchange: branches/upstream/libtest-without-module-perl/current/t/01-api.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/02-block-use-module.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/02-block-use-module.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/02-block-use-module.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/02-block-use-module.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,11 @@
+#!/usr/bin/perl -w
+use strict;
+
+use Test::More tests => 4;
+
+BEGIN{ use_ok( "Test::Without::Module", qw( Digest::MD5 )); };
+
+is_deeply( [sort keys %{Test::Without::Module::get_forbidden_list()}],[ qw[ Digest::MD5 ]],"Module list" );
+eval q{ use Digest::MD5 };
+ok( $@ ne '', 'Importing raises an error' );
+like( $@, qr!^(Can't locate Digest/MD5.pm in \@INC|Digest/MD5.pm did not return a true value at)!, "Hid module");

Propchange: branches/upstream/libtest-without-module-perl/current/t/02-block-use-module.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/03-block-require-module.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/03-block-require-module.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/03-block-require-module.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/03-block-require-module.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,26 @@
+#!/usr/bin/perl -w
+use strict;
+use Symbol qw( delete_package );
+use Test::More tests => 6;
+
+BEGIN { use_ok( "Test::Without::Module", qw( Digest::MD5 )); };
+
+{
+  use Test::Without::Module qw( Digest::MD5 );
+
+  eval { require Digest::MD5 };
+  use Test::Without::Module qw( Digest::MD5 );
+  ok( $@ ne '', "Loading raised error");
+  like( $@, qr!^(Can't locate Digest/MD5.pm in \@INC|Digest/MD5.pm did not return a true value at)!, "Hid module");
+  is_deeply( [sort keys %{Test::Without::Module::get_forbidden_list()}],[ qw[ Digest::MD5 ]],"Module list" );
+  delete_package( 'Digest::MD5' );
+};
+
+TODO: {
+  local $TODO = 'Implement lexical scoping';
+  eval { require 'Digest::MD5' };
+  is( $@, '', "Local (require) confinement");
+  delete_package( 'Digest::MD5' );
+  eval q{ use Digest::MD5 };
+  is( $@, '', "Local (use) confinement");
+};

Propchange: branches/upstream/libtest-without-module-perl/current/t/03-block-require-module.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/04-import-export.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/04-import-export.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/04-import-export.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/04-import-export.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,12 @@
+#!/usr/bin/perl -w
+use Test::More tests => 3;
+
+use_ok( 'Test::Without::Module' );
+
+use Test::Without::Module qw( File::Temp );
+no Test::Without::Module qw( File::Temp );
+
+is_deeply( [keys %{Test::Without::Module::get_forbidden_list()}],[],"Module list is empty" );
+eval { $^W = 0; require File::Temp; };
+is( $@, '', "unimport" );
+

Propchange: branches/upstream/libtest-without-module-perl/current/t/04-import-export.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/99-manifest.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/99-manifest.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/99-manifest.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/99-manifest.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,22 @@
+use strict;
+use Test::More;
+
+# Check that MANIFEST and MANIFEST.skip are sane :
+
+use File::Find;
+use File::Spec;
+
+my @files = qw( MANIFEST MANIFEST.skip );
+plan tests => scalar @files * 4;
+
+for my $file (@files) {
+  ok(-f $file, "$file exists");
+  open F, "<$file"
+    or die "Couldn't open $file : $!";
+  my @lines = <F>;
+  is_deeply([grep(/^$/, @lines)],[], "No empty lines in $file");
+  is_deeply([grep(/^\s+$/, @lines)],[], "No whitespace-only lines in $file");
+  is_deeply([grep(/^\s*\S\s+$/, @lines)],[],"No trailing whitespace on lines in $file");
+  close F;
+};
+

Propchange: branches/upstream/libtest-without-module-perl/current/t/99-manifest.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/99-pod.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/99-pod.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/99-pod.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/99-pod.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,36 @@
+use Test::More;
+
+# Check our Pod
+# The test was provided by Andy Lester,
+# who stole it from Brian D. Foy
+# Thanks to both !
+
+use File::Spec;
+use File::Find;
+use strict;
+
+eval {
+  require Test::Pod;
+  Test::Pod->import;
+};
+
+my @files;
+
+if ($@) {
+  plan skip_all => "Test::Pod required for testing POD";
+}
+elsif ($Test::Pod::VERSION < 0.95) {
+  plan skip_all => "Test::Pod 0.95 required for testing POD";
+}
+else {
+  my $blib = File::Spec->catfile(qw(blib lib));
+  find(\&wanted, $blib);
+  plan tests => scalar @files;
+  foreach my $file (@files) {
+    pod_file_ok($file);
+  }
+}
+
+sub wanted {
+  push @files, $File::Find::name if /\.p(l|m|od)$/;
+}

Propchange: branches/upstream/libtest-without-module-perl/current/t/99-pod.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/99-todo.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/99-todo.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/99-todo.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/99-todo.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,43 @@
+use Test::More;
+use File::Spec;
+use File::Find;
+use strict;
+
+# Check that all files do not contain any
+# lines with "XXX" - such markers should
+# either have been converted into Todo-stuff
+# or have been resolved.
+# The test was provided by Andy Lester.
+
+my @files;
+my $blib = File::Spec->catfile(qw(blib lib));
+find(\&wanted, $blib);
+plan tests => scalar @files;
+foreach my $file (@files) {
+  source_file_ok($file);
+}
+
+sub wanted {
+  push @files, $File::Find::name if /\.p(l|m|od)$/;
+}
+
+sub source_file_ok {
+    my $file = shift;
+
+    my $fh;
+    open( $fh, "<$file" ) or die "Can't open $file: $!";
+    my @lines = <$fh>;
+    close $fh;
+
+    my $n = 0;
+    for ( @lines ) {
+        ++$n;
+        s/^/$file ($n): /;
+    }
+
+    my @x = grep /XXX/, @lines;
+
+    if ( !is( scalar @x, 0, "Looking for XXXes in $file" ) ) {
+        diag( $_ ) for @x;
+    }
+}

Propchange: branches/upstream/libtest-without-module-perl/current/t/99-todo.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/99-unix-text.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/99-unix-text.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/99-unix-text.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/99-unix-text.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,37 @@
+use Test::More;
+
+# Check that all released module files are in
+# UNIX text format
+
+use File::Spec;
+use File::Find;
+use strict;
+
+my @files;
+
+my $blib = File::Spec->catfile(qw(blib lib));
+find(\&wanted, $blib);
+plan tests => scalar @files;
+foreach my $file (@files) {
+  unix_file_ok($file);
+}
+
+sub wanted {
+  push @files, $File::Find::name if /\.p(l|m|od)$/;
+}
+
+sub unix_file_ok {
+  my ($filename) = @_;
+  local $/;
+  open F, "< $filename"
+    or die "Couldn't open '$filename' : $!\n";
+  binmode F;
+  my $content = <F>;
+
+  my $i;
+  my @lines = grep { /\x0D\x0A$/sm } map { sprintf "%s: %s\x0A", $i++, $_ } split /\x0A/, $content;
+  unless (is(scalar @lines, 0,"'$filename' contains no windows newlines")) {
+    diag $_ for @lines;
+  };
+  close F;
+};

Propchange: branches/upstream/libtest-without-module-perl/current/t/99-unix-text.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/99-versions.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/99-versions.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/99-versions.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/99-versions.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,49 @@
+#!perl -w
+
+# Stolen from ChrisDolan on use.perl.org
+# http://use.perl.org/comments.pl?sid=29264&cid=44309
+
+use warnings;
+use strict;
+use File::Find;
+use Test::More;
+BEGIN {
+    eval 'use File::Slurp; 1';
+    if ($@) {
+        plan skip_all => "File::Slurp needed for testing";
+        exit 0;
+    };
+};
+
+plan 'no_plan';
+
+my $last_version = undef;
+
+sub check {
+      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 \s* = [^=] [^\n]* ) /gxms;
+      if (@version_lines == 0) {
+            fail($_);
+      }
+      for my $line (@version_lines) {
+            if (!defined $last_version) {
+                  $last_version = shift @version_lines;
+                  diag "Checking for $last_version";
+                  pass($_);
+            } else {
+                  is($line, $last_version, $_);
+            }
+      }
+}
+
+find({wanted => \&check, no_chdir => 1}, 'blib');
+
+if (! defined $last_version) {
+      fail('Failed to find any files with $VERSION');
+}

Propchange: branches/upstream/libtest-without-module-perl/current/t/99-versions.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libtest-without-module-perl/current/t/embedded-Test-Without-Module.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-without-module-perl/current/t/embedded-Test-Without-Module.t?rev=8410&op=file
==============================================================================
--- branches/upstream/libtest-without-module-perl/current/t/embedded-Test-Without-Module.t (added)
+++ branches/upstream/libtest-without-module-perl/current/t/embedded-Test-Without-Module.t Sun Oct 21 09:27:05 2007
@@ -1,0 +1,81 @@
+#!D:\Programme\indigoperl-5.6\bin\perl.exe -w
+
+use Test::More 'no_plan';
+
+package Catch;
+
+sub TIEHANDLE {
+    my($class, $var) = @_;
+    return bless { var => $var }, $class;
+}
+
+sub PRINT  {
+    my($self) = shift;
+    ${'main::'.$self->{var}} .= join '', @_;
+}
+
+sub OPEN  {}    # XXX Hackery in case the user redirects
+sub CLOSE {}    # XXX STDERR/STDOUT.  This is not the behavior we want.
+
+sub READ {}
+sub READLINE {}
+sub GETC {}
+sub BINMODE {}
+
+my $Original_File = 'D:lib\Test\Without\Module.pm';
+
+package main;
+
+# pre-5.8.0's warns aren't caught by a tied STDERR.
+$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
+tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
+tie *STDERR, 'Catch', '_STDERR_' or die $!;
+
+SKIP: {
+    # A header testing whether we find all prerequisites :
+      # Check for module My::Module
+  eval { require My::Module };
+  skip "Need module My::Module to run this test", 1
+    if $@;
+
+  # Check for module Test::Without::Module
+  eval { require Test::Without::Module };
+  skip "Need module Test::Without::Module to run this test", 1
+    if $@;
+
+
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+eval q{
+  my $example = sub {
+    local $^W = 0;
+
+#line 109 lib/Test/Without/Module.pm
+
+  use Test::Without::Module qw( My::Module );
+
+  # Now, loading of My::Module fails :
+  eval { require My::Module; };
+  warn $@ if $@;
+
+  # Now it works again
+  eval q{ no Test::Without::Module qw( My::Module ) };
+  eval { require My::Module; };
+  print "Found My::Module" unless $@;
+
+;
+
+  }
+};
+is($@, '', "example from line 109");
+
+};
+SKIP: {
+    # A header testing whether we find all prerequisites :
+    
+    # The original POD test
+        undef $main::_STDOUT_;
+    undef $main::_STDERR_;
+
+};

Propchange: branches/upstream/libtest-without-module-perl/current/t/embedded-Test-Without-Module.t
------------------------------------------------------------------------------
    svn:executable = 




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