Test-Lib-0.002/000755 000765 000024 00000000000 12373527007 013425 5ustar00gknopstaff000000 000000 Test-Lib-0.002/Changes000644 000765 000024 00000000310 12373527000 014703 0ustar00gknopstaff000000 000000 Revision history for Test::Lib 0.002 - 2014-08-16 - remove useless load test, being more compatible with older Test::Builder - include additional metadata - use warnings 0.001 - Initial release Test-Lib-0.002/lib/000755 000765 000024 00000000000 12373527007 014173 5ustar00gknopstaff000000 000000 Test-Lib-0.002/maint/000755 000765 000024 00000000000 12373527007 014535 5ustar00gknopstaff000000 000000 Test-Lib-0.002/Makefile.PL000644 000765 000024 00000004366 12367656176 015425 0ustar00gknopstaff000000 000000 use strict; use warnings FATAL => 'all'; my %META = ( name => 'Test-Lib', license => 'perl_5', prereqs => { test => { requires => { 'Test::More' => '0', }, }, runtime => { requires => { 'File::Spec' => 0, 'Cwd' => 0, 'perl' => 5.006, }, }, }, resources => { repository => { type => 'git', url => 'git://github.com/haarg/Test-Lib.git', web => 'https://github.com/haarg/Test-Lib', }, bugtracker => { mailto => 'bug-Test-Lib@rt.cpan.org', web => 'https://rt.cpan.org/Dist/Display.html?Name=Test-Lib', }, license => [ 'http://dev.perl.org/licenses/' ], }, dynamic_config => 0, ); my %MM_ARGS = ( 'test' => { 'TESTS' => join ' ', map { 't/' . join('/', ('*') x $_) . '.t' } 1..7, }, ); ############################################################################## require ExtUtils::MakeMaker; (do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; # have to do this since old EUMM dev releases miss the eval $VERSION line my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; my $mymeta = $eumm_version >= 6.57_02; my $mymeta_broken = $mymeta && $eumm_version < 6.57_07; ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g; ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g; $MM_ARGS{LICENSE} = $META{license} if $eumm_version >= 6.30; $MM_ARGS{NO_MYMETA} = 1 if $mymeta_broken; $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META } unless -f 'META.yml'; for (qw(configure build test runtime)) { my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES'; my $r = $MM_ARGS{$key} = { %{$META{prereqs}{$_}{requires} || {}}, %{delete $MM_ARGS{$key} || {}}, }; defined $r->{$_} or delete $r->{$_} for keys %$r; } $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0; delete $MM_ARGS{MIN_PERL_VERSION} if $eumm_version < 6.47_01; $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}} if $eumm_version < 6.63_03; $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}} if $eumm_version < 6.55_01; delete $MM_ARGS{CONFIGURE_REQUIRES} if $eumm_version < 6.51_03; ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS); Test-Lib-0.002/MANIFEST000644 000765 000024 00000001036 12373527007 014556 0ustar00gknopstaff000000 000000 Changes lib/Test/Lib.pm maint/Makefile.PL.include Makefile.PL MANIFEST This list of files t/findlib.t t/lib/tlib_test.pm t/sub1/findlib.t t/sub1/sub2/findlib.t t/sub1/sub2/sub3/findlib.t t/sub1/sub2/sub3/sub4/findlib.t t/sub1/sub2/sub3/sub4/sub5/findlib.t t/sub1/sub2/sub3/sub4/sub5/sub6/no_findlib.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) README README file (added by Distar) Test-Lib-0.002/META.json000644 000765 000024 00000002415 12373527007 015050 0ustar00gknopstaff000000 000000 { "abstract" : "Use libraries from a t/lib directory", "author" : [ "haarg - Graham Knop (cpan:HAARG) " ], "dynamic_config" : 0, "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-Lib", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : {}, "configure" : {}, "runtime" : { "requires" : { "Cwd" : "0", "File::Spec" : "0", "perl" : "5.006" } }, "test" : { "requires" : { "Test::More" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-Test-Lib@rt.cpan.org", "web" : "https://rt.cpan.org/Dist/Display.html?Name=Test-Lib" }, "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/haarg/Test-Lib.git", "web" : "https://github.com/haarg/Test-Lib" } }, "version" : "0.002" } Test-Lib-0.002/META.yml000644 000765 000024 00000001224 12373527007 014675 0ustar00gknopstaff000000 000000 --- abstract: 'Use libraries from a t/lib directory' author: - 'haarg - Graham Knop (cpan:HAARG) ' build_requires: Test::More: '0' dynamic_config: 0 generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-Lib no_index: directory: - t - inc requires: Cwd: '0' File::Spec: '0' perl: '5.006' resources: bugtracker: https://rt.cpan.org/Dist/Display.html?Name=Test-Lib license: http://dev.perl.org/licenses/ repository: git://github.com/haarg/Test-Lib.git version: '0.002' Test-Lib-0.002/README000644 000765 000024 00000001507 12373527007 014310 0ustar00gknopstaff000000 000000 NAME Test::Lib - Use libraries from a t/lib directory SYNOPSIS use Test::Lib; use Test::More; use Private::Testing::Module; ok 1, 'passing test'; my_test 'test from private module'; DESCRIPTION Searches upward from the calling module for a directory t with a lib directory inside it, and adds it to the module search path. Looks upward up to 5 directories. This is intended to be used in test modules either directly in t or in a subdirectory to find their included testing libraries located in t/lib. AUTHOR Graham Knop COPYRIGHT AND LICENSE This software is Copyright (c) 2012 by Graham Knop. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Test-Lib-0.002/t/000755 000765 000024 00000000000 12373527007 013670 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/findlib.t000644 000765 000024 00000000125 12367655202 015464 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 1; use Test::Lib; require_ok 'tlib_test'; 1; Test-Lib-0.002/t/lib/000755 000765 000024 00000000000 12373527007 014436 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/000755 000765 000024 00000000000 12373527007 014542 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/findlib.t000644 000765 000024 00000000125 12367655202 016336 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 1; use Test::Lib; require_ok 'tlib_test'; 1; Test-Lib-0.002/t/sub1/sub2/000755 000765 000024 00000000000 12373527007 015415 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/sub2/findlib.t000644 000765 000024 00000000125 12367655202 017211 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 1; use Test::Lib; require_ok 'tlib_test'; 1; Test-Lib-0.002/t/sub1/sub2/sub3/000755 000765 000024 00000000000 12373527007 016271 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/sub2/sub3/findlib.t000644 000765 000024 00000000125 12367655202 020065 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 1; use Test::Lib; require_ok 'tlib_test'; 1; Test-Lib-0.002/t/sub1/sub2/sub3/sub4/000755 000765 000024 00000000000 12373527007 017146 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/sub2/sub3/sub4/findlib.t000644 000765 000024 00000000125 12367655202 020742 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 1; use Test::Lib; require_ok 'tlib_test'; 1; Test-Lib-0.002/t/sub1/sub2/sub3/sub4/sub5/000755 000765 000024 00000000000 12373527007 020024 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/sub2/sub3/sub4/sub5/findlib.t000644 000765 000024 00000000125 12367655202 021620 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 1; use Test::Lib; require_ok 'tlib_test'; 1; Test-Lib-0.002/t/sub1/sub2/sub3/sub4/sub5/sub6/000755 000765 000024 00000000000 12373527007 020703 5ustar00gknopstaff000000 000000 Test-Lib-0.002/t/sub1/sub2/sub3/sub4/sub5/sub6/no_findlib.t000644 000765 000024 00000000443 12367655202 023176 0ustar00gknopstaff000000 000000 use strict; use Test::More tests => 3; require Test::Lib; ok !eval { Test::Lib->import; 1 }, 'tlib import dies to find t/lib more than 5 levels up'; like $@, qr{^unable to find t/lib directory in }, 'error message correct'; ok !eval { require tlib_test; 1 }, 'nothing added to @INC'; 1; Test-Lib-0.002/t/lib/tlib_test.pm000644 000765 000024 00000000003 12367655202 016760 0ustar00gknopstaff000000 000000 1; Test-Lib-0.002/maint/Makefile.PL.include000644 000765 000024 00000000272 12367656310 020135 0ustar00gknopstaff000000 000000 BEGIN { -e 'Distar' or system("git clone git://git.shadowcat.co.uk/p5sagit/Distar.git") } use lib 'Distar/lib'; use Distar; author 'haarg - Graham Knop (cpan:HAARG) '; Test-Lib-0.002/lib/Test/000755 000765 000024 00000000000 12373527007 015112 5ustar00gknopstaff000000 000000 Test-Lib-0.002/lib/Test/Lib.pm000644 000765 000024 00000003203 12373526641 016157 0ustar00gknopstaff000000 000000 package Test::Lib; use strict; use warnings; our $VERSION = '0.002'; $VERSION = eval $VERSION; use File::Spec; use Cwd (); use lib (); sub import { my $class = shift; my $dir = shift; if (! defined $dir) { my $file = File::Spec->rel2abs((caller)[1]); $dir = File::Spec->catpath((File::Spec->splitpath($file))[0,1], ''); } for my $i (0..5) { my $tdir = File::Spec->catdir($dir, (File::Spec->updir) x $i); my $abs_path = Cwd::abs_path($tdir); my $dirname = (File::Spec->splitdir($abs_path))[-1]; if ($dirname eq 't') { my $tlib = File::Spec->catdir($tdir, 'lib'); if (-d $tlib) { lib->import($tlib); return; } } } die "unable to find t/lib directory in $dir"; } 1; __END__ =head1 NAME Test::Lib - Use libraries from a t/lib directory =head1 SYNOPSIS use Test::Lib; use Test::More; use Private::Testing::Module; ok 1, 'passing test'; my_test 'test from private module'; =head1 DESCRIPTION Searches upward from the calling module for a directory F with a F directory inside it, and adds it to the module search path. Looks upward up to 5 directories. This is intended to be used in test modules either directly in F or in a subdirectory to find their included testing libraries located in F. =head1 AUTHOR Graham Knop =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2012 by Graham Knop. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut