Build.PL100644000765000024 314012434114771 16064 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6# ========================================================================= # THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA. # DO NOT EDIT DIRECTLY. # ========================================================================= use 5.008_001; use strict; use warnings; use utf8; use Module::Build; use File::Basename; use File::Spec; my %args = ( license => 'perl', dynamic_config => 0, configure_requires => { 'Module::Build' => 0.38, }, name => 'Test-Module-Used', module_name => 'Test::Module::Used', allow_pureperl => 0, script_files => [glob('script/*'), glob('bin/*')], c_source => [qw()], PL_files => {}, test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/', recursive_test_files => 1, ); if (-d 'share') { $args{share_dir} = 'share'; } my $builder = Module::Build->subclass( class => 'MyBuilder', code => q{ sub ACTION_distmeta { die "Do not run distmeta. Install Minilla and `minil install` instead.\n"; } sub ACTION_installdeps { die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n"; } } )->new(%args); $builder->create_build_script(); use File::Copy; print "cp META.json MYMETA.json\n"; copy("META.json","MYMETA.json") or die "Copy failed(META.json): $!"; if (-f 'META.yml') { print "cp META.yml MYMETA.yml\n"; copy("META.yml","MYMETA.yml") or die "Copy failed(META.yml): $!"; } else { print "There is no META.yml... You may install this module from the repository...\n"; } Changes100755000765000024 454212434114771 16075 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.60.2.6 2014-11-22T14:12:23Z - repackage(no internal change) 0.2.5 2014-11-19T11:28:17Z - migrate to Minilla - fix: RT#100270 for Test-Module-Used: Test::More alphas break this. 0.2.4 - fix: RT#81553 Test failures due to hash randomisation in perl 5.17.6 (thanks ANDK) 0.2.3 - fix: tests are failed when using newer Parse::CPAN::Meta. 0.2.2 - version++ - update year in copyright (no other changes from 0.2.1_04) 0.2.1_04 - add tests - refactorings 0.2.1_03 - implement used_ok() and requires_ok() 0.2.1_02 - fix: forget to use Carp 0.2.1_01 - META.json support 0.2.0 - add AuthorRequires - uniquify module lists 0.1.9 - fix: modules used in test_lib_dir are ignored.(RT#54187) - ChangeLog format change(Because ShipIt doesn't support previous format) 0.1.8 - remove executable permission in Makefile.PL 0.1.7 - add repository in Makefile.PL (merge from git://github.com/cpanservice/Test-Module-Used.git) 0.1.6 - fix: add copyright information(for RT#53290) 0.1.5 - fix: insufficient version of version.pm specified. 0.1.4 - improve error messages when test fails. 0.1.3_02 - fix: POD structure(chaptering) is insufficient. 0.1.3_01 - deprecated parameters are deleted - read perl version from META.yml and NOT from *.pm 0.1.2 - add parameter 'test_lib_dir' in constructor and automatically push exclude_in_testdir to modules which are in test_lib_dir. 0.1.1 - fix: failed if package statement doesn't exist in *.pm file. 0.1.0 - fix: fix again test failed in windows environment remove all slash directory separator, and instead of using catfile(). 0.0.9 - fix: test failed in windows environment 0.0.8 - implement push_exclude_in_{test,module}dir(), it enables set exclude_in_{test,module}dir after new() 0.0.7 - fix: bugs in version fetching from file. 0.0.6 - refactoring methods and some optimization find bug in handling core module 0.0.5 - fix: test faild in windows environment 0.0.4 - found bug in ok(module_requires exclude) add build_requires and requires exclusion in constructor 0.0.3 - add ChangeLog and README - describe about perl_version - bug fix (failed when test is empty) - parse perlversion using Perl::MinimumVersion 0.0.2 - fix insufficient index(set no_index to testdata) 0.0.1 - initial release LICENSE100644000765000024 4375412434114771 15634 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6This software is copyright (c) 2014 by Takuya Tsuchida . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Takuya Tsuchida . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Takuya Tsuchida . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End META.json100644000765000024 412712434114771 16217 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6{ "abstract" : "Test required module is really used and vice versa between lib/t and META.yml", "author" : [ "Takuya Tsuchida " ], "dynamic_config" : 0, "generated_by" : "Minilla/v2.1.1", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-Module-Used", "no_index" : { "directory" : [ "testdata", "t", "xt", "inc", "share", "eg", "examples", "author", "builder" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "6.59", "Test::Builder::Tester" : "0", "Test::More" : "0.98" } }, "configure" : { "requires" : { "Module::Build" : "0.38" } }, "develop" : { "requires" : { "Test::CPAN::Meta" : "0", "Test::MinimumVersion::Fast" : "0.04", "Test::PAUSE::Permissions" : "0.04", "Test::Pod" : "1.41", "Test::Spellunker" : "v0.2.7" } }, "runtime" : { "requires" : { "CPAN::Meta" : "0", "List::MoreUtils" : "0", "Module::CoreList" : "0", "Module::Used" : "0", "PPI::Document" : "0", "perl" : "5.008001", "version" : "0.77" } } }, "provides" : { "Test::Module::Used" : { "file" : "lib/Test/Module/Used.pm", "version" : "v0.2.6" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/tsucchi/Test-Module-Used/issues" }, "homepage" : "https://github.com/tsucchi/Test-Module-Used", "repository" : { "url" : "git://github.com/tsucchi/Test-Module-Used.git", "web" : "https://github.com/tsucchi/Test-Module-Used" } }, "version" : "0.2.6", "x_contributors" : [ "CPAN Service " ] } README.md100644000765000024 1252112434114771 16072 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6[![Build Status](https://travis-ci.org/tsucchi/Test-Module-Used.png?branch=master)](https://travis-ci.org/tsucchi/Test-Module-Used) [![Coverage Status](https://coveralls.io/repos/tsucchi/Test-Module-Used/badge.png?branch=master)](https://coveralls.io/r/tsucchi/Test-Module-Used?branch=master) # NAME Test::Module::Used - Test required module is really used and vice versa between lib/t and META.yml # SYNOPSIS #!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; my $used = Test::Module::Used->new(); $used->ok; # DESCRIPTION Test dependency between module and META.yml. This module reads _META.yml_ and get _build\_requires_ and _requires_. It compares required module is really used and used module is really required. # Important changes Some behavior changed since 0.1.3\_01. - perl\_version set in constructor is prior to use, and read version from META.yml(not read from use statement in \*.pm) - deprecated interfaces are deleted. (module\_dir, test\_module\_dir, exclude\_in\_moduledir and push\_exclude\_in\_moduledir) # methods ## new create new instance all parameters are passed by hash-style, and optional. in ordinary use. my $used = Test::Module::Used->new(); $used->ok(); all parameters are as follows.(specified values are default, except _exclude\_in\_testdir_) my $used = Test::Module::Used->new( test_dir => ['t'], # directory(ies) which contains test scripts. lib_dir => ['lib'], # directory(ies) which contains module libs. test_lib_dir => ['t'], # directory(ies) which contains libs used ONLY in test (ex. MockObject for test) meta_file => 'META.json' or 'META.yml' or 'META.yaml', # META file (YAML or JSON which contains module requirement information) perl_version => '5.008', # expected perl version which is used for ignore core-modules in testing exclude_in_testdir => [], # ignored module(s) for test even if it is used. exclude_in_libdir => [], # ignored module(s) for your lib even if it is used. exclude_in_build_requires => [], # ignored module(s) even if it is written in build_requires of META.yml. exclude_in_requires => [], # ignored module(s) even if it is written in requires of META.yml. ); if perl\_version is not passed in constructor, this modules reads _meta\_file_ and get perl version. _exclude\_in\_testdir_ is automatically set by default. This module reads _lib\_dir_ and parse "package" statement, then found "package" statements and myself(Test::Module::Used) is set. _exclude\_in\_libdir_ is also automatically set by default. This module reads _lib\_dir_ and parse "package" statement, found "package" statement are set.(Test::Module::Used isn't included) ## ok() check used modules are required in META file and required modules in META files are used. my $used = Test::Module::Used->new( exclude_in_testdir => ['Test::Module::Used', 'My::Module'], ); $used->ok; First, This module reads _META.yml_ and get _build\_requires_ and _requires_. Next, reads module directory (by default _lib_) and test directory(by default _t_), and compare required module is really used and used module is really required. If all these requirement information is OK, test will success. It is NOT allowed to call ok(), used\_ok() and requires\_ok() in same test file. ## used\_ok() Only check used modules are required in META file. Test will success if unused _requires_ or _build\_requires_ are defined. my $used = Test::Module::Used->new(); $used->used_ok; It is NOT allowed to call ok(), used\_ok() and requires\_ok() in same test file. ## requires\_ok() Only check required modules in META file is used. Test will success if used modules are not defined in META file. my $used = Test::Module::Used->new(); $used->requires_ok; It is NOT allowed to call ok(), used\_ok() and requires\_ok() in same test file. ## push\_exclude\_in\_libdir( @exclude\_module\_names ) add ignored module(s) for your module(lib) even if it is used after new()'ed. this is usable if you want to use auto set feature for _exclude\_in\_libdir_ but manually specify exclude modules. For example, my $used = Test::Module::Used->new(); #automatically set exclude_in_libdir $used->push_exclude_in_libdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude $used->ok(); #do test ## push\_exclude\_in\_testdir( @exclude\_module\_names ) add ignored module(s) for test even if it is used after new()'ed. this is usable if you want to use auto set feature for _exclude\_in\_testdir_ but manually specify exclude modules. For example, my $used = Test::Module::Used->new(); #automatically set exclude_in_testdir $used->push_exclude_in_testdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude $used->ok(); #do test # AUTHOR Takuya Tsuchida # SEE ALSO [Test::Dependencies](https://metacpan.org/pod/Test::Dependencies) has almost same feature. # REPOSITORY [http://github.com/tsucchi/Test-Module-Used](http://github.com/tsucchi/Test-Module-Used) # COPYRIGHT AND LICENSE Copyright (c) 2008-2014 Takuya Tsuchida This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. cpanfile100644000765000024 50412434114771 16255 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6requires 'CPAN::Meta'; requires 'List::MoreUtils'; requires 'Module::CoreList'; requires 'Module::Used'; requires 'PPI::Document'; requires 'perl', '5.008'; requires 'version', '0.77'; on build => sub { requires 'ExtUtils::MakeMaker', '6.59'; requires 'Test::Builder::Tester'; requires 'Test::More', '0.98'; }; Used.pm100755000765000024 4117312434114771 20773 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/lib/Test/Modulepackage Test::Module::Used; use base qw(Exporter); use strict; use warnings; use File::Find; use File::Spec::Functions qw(catfile); use Module::Used qw(modules_used_in_document); use Module::CoreList; use Test::Builder; use List::MoreUtils qw(any uniq all); use PPI::Document; use version; use CPAN::Meta; use Carp; use 5.008001; our $VERSION = '0.2.6'; =for stopwords versa =head1 NAME Test::Module::Used - Test required module is really used and vice versa between lib/t and META.yml =head1 SYNOPSIS #!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; my $used = Test::Module::Used->new(); $used->ok; =head1 DESCRIPTION Test dependency between module and META.yml. This module reads I and get I and I. It compares required module is really used and used module is really required. =cut =head1 Important changes Some behavior changed since 0.1.3_01. =over 4 =item * perl_version set in constructor is prior to use, and read version from META.yml(not read from use statement in *.pm) =item * deprecated interfaces are deleted. (module_dir, test_module_dir, exclude_in_moduledir and push_exclude_in_moduledir) =back =cut =head1 methods =cut =head2 new create new instance all parameters are passed by hash-style, and optional. in ordinary use. my $used = Test::Module::Used->new(); $used->ok(); all parameters are as follows.(specified values are default, except I) my $used = Test::Module::Used->new( test_dir => ['t'], # directory(ies) which contains test scripts. lib_dir => ['lib'], # directory(ies) which contains module libs. test_lib_dir => ['t'], # directory(ies) which contains libs used ONLY in test (ex. MockObject for test) meta_file => 'META.json' or 'META.yml' or 'META.yaml', # META file (YAML or JSON which contains module requirement information) perl_version => '5.008', # expected perl version which is used for ignore core-modules in testing exclude_in_testdir => [], # ignored module(s) for test even if it is used. exclude_in_libdir => [], # ignored module(s) for your lib even if it is used. exclude_in_build_requires => [], # ignored module(s) even if it is written in build_requires of META.yml. exclude_in_requires => [], # ignored module(s) even if it is written in requires of META.yml. ); if perl_version is not passed in constructor, this modules reads I and get perl version. I is automatically set by default. This module reads I and parse "package" statement, then found "package" statements and myself(Test::Module::Used) is set. I is also automatically set by default. This module reads I and parse "package" statement, found "package" statement are set.(Test::Module::Used isn't included) =cut sub new { my $class = shift; my (%opt) = @_; my $self = { test_dir => $opt{test_dir} || ['t'], lib_dir => $opt{lib_dir} || ['lib'], test_lib_dir => $opt{test_lib_dir} || ['t'], meta_file => _find_meta_file($opt{meta_file}), perl_version => $opt{perl_version}, exclude_in_testdir => $opt{exclude_in_testdir}, exclude_in_libdir => $opt{exclude_in_libdir}, exclude_in_build_requires => $opt{exclude_in_build_requires} || [], exclude_in_requires => $opt{exclude_in_requires} || [], }; bless $self, $class; $self->_get_packages(); return $self; } sub _find_meta_file { my ($opt_meta_file) = @_; return $opt_meta_file if ( defined $opt_meta_file ); for my $file ( qw(META.json META.yml META.yaml) ) { return $file if ( -e $file ); } croak "META file not found\n"; } sub _test_dir { return shift->{test_dir}; } sub _lib_dir { return shift->{lib_dir}; } sub _test_lib_dir { return shift->{test_lib_dir}; } sub _meta_file { return shift->{meta_file}; } sub _perl_version { return shift->{perl_version}; } =head2 ok() check used modules are required in META file and required modules in META files are used. my $used = Test::Module::Used->new( exclude_in_testdir => ['Test::Module::Used', 'My::Module'], ); $used->ok; First, This module reads I and get I and I. Next, reads module directory (by default I) and test directory(by default I), and compare required module is really used and used module is really required. If all these requirement information is OK, test will success. It is NOT allowed to call ok(), used_ok() and requires_ok() in same test file. =cut sub ok { my $self = shift; return $self->_ok(\&_num_tests, \&_used_ok, \&_requires_ok); } =head2 used_ok() Only check used modules are required in META file. Test will success if unused I or I are defined. my $used = Test::Module::Used->new(); $used->used_ok; It is NOT allowed to call ok(), used_ok() and requires_ok() in same test file. =cut sub used_ok { my $self = shift; return $self->_ok(\&_num_tests_used_ok, \&_used_ok); } =head2 requires_ok() Only check required modules in META file is used. Test will success if used modules are not defined in META file. my $used = Test::Module::Used->new(); $used->requires_ok; It is NOT allowed to call ok(), used_ok() and requires_ok() in same test file. =cut sub requires_ok { my $self = shift; return $self->_ok(\&_num_tests_requires_ok, \&_requires_ok); } sub _ok { my $self = shift; my ($num_tests_subref, @ok_subrefs) = @_; croak('Already tested. Calling ok(), used_ok() and requires_ok() in same test file is not allowed') if ( !!$self->{tested} ); my $num_tests = $num_tests_subref->($self); return $self->_do_test($num_tests, @ok_subrefs); } sub _do_test { my $self = shift; my ($num_tests, @ok_subrefs) = @_; my $test = Test::Builder->new(); my $test_status = $num_tests > 0 ? $self->_do_test_normal($num_tests, @ok_subrefs) : $self->_do_test_no_tests(); $self->{tested} = 1; return !!$test_status; } sub _do_test_normal { my $self = shift; my ($num_tests, @ok_subrefs) = @_; my $test = Test::Builder->new(); $test->plan(tests => $num_tests); my @status; for my $ok_subref ( @ok_subrefs ) { push(@status, $ok_subref->($self, $test)); } my $test_status = all { $_ } @status; return !!$test_status; } sub _do_test_no_tests { my $self = shift; my $test = Test::Builder->new(); $test->plan(tests => 1); $test->ok(1, "no tests run"); return 1; } sub _used_ok { my $self = shift; my ($test) = @_; my $status_lib = $self->_check_used_but_not_required($test, [$self->_remove_core($self->_used_modules)], [$self->_remove_core($self->_requires)], "lib"); my $status_test = $self->_check_used_but_not_required($test, [$self->_remove_core($self->_used_modules_in_test)], [$self->_remove_core($self->_build_requires)], "test"); return $status_lib && $status_test; } sub _requires_ok { my $self = shift; my ($test) = @_; my $status_lib = $self->_check_required_but_not_used($test, [$self->_remove_core($self->_used_modules)], [$self->_remove_core($self->_requires)], "lib"); my $status_test = $self->_check_required_but_not_used($test, [$self->_remove_core($self->_used_modules_in_test)], [$self->_remove_core($self->_build_requires)], "test"); return $status_lib && $status_test; } =head2 push_exclude_in_libdir( @exclude_module_names ) add ignored module(s) for your module(lib) even if it is used after new()'ed. this is usable if you want to use auto set feature for I but manually specify exclude modules. For example, my $used = Test::Module::Used->new(); #automatically set exclude_in_libdir $used->push_exclude_in_libdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude $used->ok(); #do test =cut sub push_exclude_in_libdir { my $self = shift; my @exclude_module_names = @_; push @{$self->{exclude_in_libdir}},@exclude_module_names; } =head2 push_exclude_in_testdir( @exclude_module_names ) add ignored module(s) for test even if it is used after new()'ed. this is usable if you want to use auto set feature for I but manually specify exclude modules. For example, my $used = Test::Module::Used->new(); #automatically set exclude_in_testdir $used->push_exclude_in_testdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude $used->ok(); #do test =cut sub push_exclude_in_testdir { my $self = shift; my @exclude_module_names = @_; push @{$self->{exclude_in_testdir}},@exclude_module_names; } sub _version { my $self = shift; if ( !defined $self->{version} ) { $self->{version} = $self->_perl_version || $self->_version_from_meta || "5.008000"; } return $self->{version}; } sub _num_tests { my $self = shift; return $self->_num_tests_used_ok() + $self->_num_tests_requires_ok(); } sub _num_tests_used_ok { my $self = shift; return scalar($self->_remove_core($self->_used_modules, $self->_used_modules_in_test)); } sub _num_tests_requires_ok { my $self = shift; return scalar($self->_remove_core($self->_requires, $self->_build_requires)); } sub _check_required_but_not_used { my $self = shift; my ($test, $used_aref, $requires_aref, $place) = @_; my @requires = @{$requires_aref}; my @used = @{$used_aref}; my $result = 1; for my $requires ( @requires ) { my $status = any { $_ eq $requires } @used; $test->ok( $status, "check required module: $requires" ); if ( !$status ) { $test->diag("module $requires is required in META file but not used in $place"); $result = 0; } } return $result; } sub _check_used_but_not_required { my $self = shift; my ($test, $used_aref, $requires_aref, $place) = @_; my @requires = @{$requires_aref}; my @used = @{$used_aref}; my $result = 1; for my $used ( @used ) { my $status = any { $_ eq $used } @requires; $test->ok( $status, "check used module: $used" ); if ( !$status ) { $test->diag("module $used is used in $place but not required"); $result = 0; } } return $result; } sub _pm_files { my $self = shift; if ( !defined $self->{pm_files} ) { my @files = $self->_find_files_by_ext($self->_lib_dir, qr/\.pm$/); $self->{pm_files} = \@files; } return @{$self->{pm_files}}; } sub _pm_files_in_test { my $self = shift; if ( !defined $self->{pm_files_in_test} ) { my @files = $self->_find_files_by_ext($self->_test_lib_dir, qr/\.pm$/); $self->{pm_files_in_test} = \@files; } return @{$self->{pm_files_in_test}}; } sub _test_files { my $self = shift; return ( $self->_find_files_by_ext($self->_test_dir, qr/\.t$/), $self->_pm_files_in_test() ); } sub _find_files_by_ext { my $self = shift; my ($start_dirs_aref, $ext_qr) = @_; my @result; find( sub { push @result, catfile($File::Find::dir, $_) if ( $_ =~ $ext_qr ); }, @{$start_dirs_aref}); return @result; } sub _used_modules { my $self = shift; if ( !defined $self->{used_modules} ) { my @used = map { modules_used_in_document($self->_ppi_for($_)) } $self->_pm_files; my @result = uniq _array_difference(\@used, $self->{exclude_in_libdir}); $self->{used_modules} = \@result; } return @{$self->{used_modules}}; } sub _used_modules_in_test { my $self = shift; if ( !defined $self->{used_modules_in_test} ) { my @used = map { modules_used_in_document($self->_ppi_for($_)) } $self->_test_files; my @result = uniq _array_difference(\@used, $self->{exclude_in_testdir}); $self->{used_modules_in_test} = \@result; } return @{$self->{used_modules_in_test}}; } sub _array_difference { my ( $aref1, $aref2 ) = @_; my @a1 = @{$aref1}; my @a2 = @{$aref2}; for my $a2 ( @a2 ) { @a1 = grep { $_ ne $a2 } @a1; } my @result = sort @a1; return @result; } sub _version_from_meta { my $self = shift; return $self->{version_from_meta}; } sub _remove_core { my $self = shift; my( @module_names ) = @_; my @result = grep { !$self->_is_core_module($_) } @module_names; return @result; } sub _is_core_module { my $self = shift; my($module_name) = @_; my $first_release = Module::CoreList->first_release($module_name); return defined $first_release && $first_release <= $self->_version; } sub _read_meta { my $self = shift; my $meta = CPAN::Meta->load_file( $self->_meta_file ); my $prereqs = $meta->prereqs(); $self->{build_requires} = $prereqs->{build}->{requires}; my $requires = $prereqs->{runtime}->{requires}; $self->{version_from_meta} = version->parse($requires->{perl})->numify() if defined $requires->{perl}; delete $requires->{perl}; $self->{requires} = $requires; } sub _build_requires { my $self = shift; $self->_read_meta if !defined $self->{build_requires}; my @result = sort keys %{$self->{build_requires}}; return _array_difference(\@result, $self->{exclude_in_build_requires}); } sub _requires { my $self = shift; $self->_read_meta if !defined $self->{requires}; my @result = sort keys %{$self->{requires}}; return _array_difference(\@result, $self->{exclude_in_requires}); } # find package statements in lib sub _get_packages { my $self = shift; my @packages = $self->_packages_in( $self->_pm_files ); my @exclude_in_testdir = (__PACKAGE__, @packages, $self->_packages_in($self->_pm_files_in_test)); $self->push_exclude_in_testdir(@exclude_in_testdir) if ( !defined $self->{exclude_in_testdir} ); $self->push_exclude_in_libdir(@packages) if ( !defined $self->{exclude_in_libdir} ); } sub _packages_in { my $self = shift; my ( @filenames ) = @_; my @result; for my $filename ( @filenames ) { my @packages = $self->_packages_in_file($filename); push @result, @packages; } return @result; } sub _packages_in_file { my $self = shift; my ( $filename ) = @_; my @ppi_package_statements = $self->_ppi_package_statements($filename); my @result; for my $ppi_package_statement ( @ppi_package_statements ) { push @result, $self->_package_names_in($ppi_package_statement); } return @result; } sub _ppi_package_statements { my $self = shift; my ($filename) = @_; my $doc = $self->_ppi_for($filename); my $packages = $doc->find('PPI::Statement::Package'); return if ( $packages eq '' ); return @{ $packages }; } sub _package_names_in { my $self = shift; my ($ppi_package_statement) = @_; my @result; for my $token ( @{$ppi_package_statement->{children}} ) { next if ( !$self->_is_package_name($token) ); push @result, $token->content; } return @result; } sub _is_package_name { my $self = shift; my ($ppi_token) = @_; return $ppi_token->isa('PPI::Token::Word') && $ppi_token->content ne 'package'; } # PPI::Document object for $filename sub _ppi_for { my $self = shift; my ($filename) = @_; if ( !defined $self->{ppi_for}->{$filename} ) { my $doc = PPI::Document->new($filename); $self->{ppi_for}->{$filename} = $doc; } return $self->{ppi_for}->{$filename}; } 1; __END__ =head1 AUTHOR Takuya Tsuchida Etsucchi@cpan.orgE =head1 SEE ALSO L has almost same feature. =head1 REPOSITORY L =head1 COPYRIGHT AND LICENSE Copyright (c) 2008-2014 Takuya Tsuchida This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut minil.toml100644000765000024 24112434114771 16554 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6name = "Test-Module-Used" badges = ["travis", "coveralls"] [no_index] directory = ['testdata', 't', 'xt', 'inc', 'share', 'eg', 'examples', 'author', 'builder']001_use_ok.t100755000765000024 16212434114771 17051 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { use_ok('Test::Module::Used') }; done_testing; 002_default.t100755000765000024 46412434114771 17216 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::More; use Test::Module::Used; my $used = Test::Module::Used->new(); is_deeply($used->_test_dir, ['t']);#default directory for test is_deeply($used->_lib_dir, ['lib']); is($used->_meta_file, 'META.json'); is($used->_version, '5.008000'); done_testing; 003_option.t100755000765000024 103212434114771 17113 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::More; use Test::Module::Used; use File::Spec::Functions qw(catfile); my $used = Test::Module::Used->new( test_dir => ['t', 'xt'], lib_dir => ['lib', catfile('testdata', 'lib')], meta_file => 'Meta.yml', perl_version => '5.010', ); is_deeply($used->_test_dir, ['t', 'xt']); is_deeply($used->_lib_dir, ['lib', catfile('testdata', 'lib')]); is($used->_meta_file, 'Meta.yml'); is($used->_perl_version, '5.010'); is($used->_version, '5.010'); done_testing; 004_used_ok.t100755000765000024 53612434114771 17225 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; use File::Spec::Functions qw(catfile); my $used = Test::Module::Used->new( lib_dir => [catfile('testdata', 'lib')], test_dir => [catfile('testdata', 't')], meta_file => catfile('testdata', 'META2.yml'), exclude_in_testdir => ['SampleModule'], ); $used->ok; 005_used_module.t100755000765000024 407612434114771 20125 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::More; use File::Spec::Functions qw(catfile); use Test::Module::Used; my $used = Test::Module::Used->new( lib_dir => [catfile('testdata', 'lib')], test_dir => [catfile('testdata', 't')], perl_version => '5.008', ); is_deeply([$used->_pm_files], [catfile('testdata', 'lib', 'SampleModule.pm')]); is_deeply([$used->_test_files], [catfile('testdata', 't', '001_test.t')]); is_deeply([$used->_used_modules()], [qw(Module::Used Net::FTP Test::Module::Used)]); is_deeply([$used->_used_modules_in_test()], [qw(Test::Class Test::More)]);# SampleModule is ignored is($used->_version, '5.008');# used version is_deeply( [$used->_remove_core(qw(Module::Used Net::FTP Test::Module::Used))], ['Module::Used', 'Test::Module::Used'] ); # exclude my $used2 = Test::Module::Used->new( lib_dir => [catfile('testdata', 'lib')], test_dir => [catfile('testdata', 't')], exclude_in_libdir => ['Module::Used'], exclude_in_testdir => ['Test::Class'], ); is_deeply([$used2->_used_modules()], [qw(Net::FTP Test::Module::Used)]); is_deeply([$used2->_used_modules_in_test()], [qw(SampleModule Test::More)]); # exclude after constructed my $used3 = Test::Module::Used->new( lib_dir => [catfile('testdata', 'lib')], test_dir => [catfile('testdata', 't')], ); $used3->push_exclude_in_libdir(qw(Module::Used Net::FTP)); is_deeply([$used3->_used_modules()], [qw(Test::Module::Used)]); $used3->push_exclude_in_testdir( qw(Test::More Test::Class) ); is_deeply([$used3->_used_modules_in_test()], []); # contains modules in test_dir (RT#54187) my $used4 = Test::Module::Used->new( test_dir => [catfile('testdata', 't2')], test_lib_dir => [catfile('testdata', 't2', 'lib')], lib_dir => [catfile('testdata', 'lib2')], meta_file => catfile('testdata', 'META3.yml'), ); is_deeply([$used4->_test_files], [catfile('testdata', 't2', '001_use_ok.t'), catfile('testdata', 't2', 'lib', 'My', 'Test2.pm')]); is_deeply([$used4->_remove_core($used4->_used_modules_in_test())], [qw(List::MoreUtils)]); done_testing; 006_read_meta_yml.t100755000765000024 237312434114771 20421 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::More; use Test::Module::Used; use File::Spec::Functions qw(catfile); my $used = Test::Module::Used->new( meta_file => catfile('testdata', 'META.yml'), ); $used->_read_meta(); is_deeply( [$used->_build_requires()], ['ExtUtils::MakeMaker', 'Test::More'] ); is_deeply( [$used->_requires()], ['Module::Used', 'PPI::Document'] );#perl 5.8.0 isn't return is($used->_version_from_meta(), "5.008000"); is($used->_version, "5.008000"); my $used2 = Test::Module::Used->new( meta_file => catfile('testdata', 'META2.yml'), ); $used2->_read_meta(); is_deeply( [$used2->_build_requires()], ['ExtUtils::MakeMaker', 'Test::Class', 'Test::More' ] ); is_deeply( [$used2->_requires()], ['Module::Used', 'Test::Module::Used'] );#perl 5.8.0 isn't return # exclude my $used3 = Test::Module::Used->new( meta_file => catfile('testdata', 'META2.yml'), exclude_in_build_requires => ['Test::Class'], exclude_in_requires => ['Module::Used'], ); $used3->_read_meta(); is_deeply( [$used3->_build_requires()], ['ExtUtils::MakeMaker', 'Test::More' ] ); is_deeply( [$used3->_requires()], ['Test::Module::Used'] );#perl 5.8.0 isn't return done_testing; 007_test_myself.t100755000765000024 25312434114771 20131 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; my $used = Test::Module::Used->new( exclude_in_testdir => ['Test::Module::Used'], ); $used->ok; 008_test_is_empty.t100755000765000024 54312434114771 20466 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; use File::Spec::Functions qw(catfile); my $used = Test::Module::Used->new( test_dir => [catfile('testdata', 't2')], lib_dir => [catfile('testdata', 'lib2')], meta_file => catfile('testdata', 'META3.yml'), exclude_in_testdir => ['Test::Module::Used'], ); $used->ok; 009_auto_get_exclude.t100755000765000024 211312434114771 21132 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::More; use Test::Module::Used; use File::Spec::Functions qw(catfile); my $used = Test::Module::Used->new( test_dir => [catfile('testdata', 't2')], lib_dir => [catfile('testdata', 'lib2')], meta_file => catfile('testdata', 'META3.yml'), ); is_deeply([$used->_packages_in($used->_pm_files)], ['My::Test']); $used->_get_packages; is_deeply($used->{exclude_in_testdir}, ['Test::Module::Used', 'My::Test']); is_deeply($used->{exclude_in_libdir}, ['My::Test']); my $used1 = Test::Module::Used->new( test_dir => [catfile('testdata', 't2')], lib_dir => [catfile('testdata', 'lib2')], test_lib_dir => [catfile('testdata', 't2', 'lib')], meta_file => catfile('testdata', 'META3.yml'), ); is_deeply([$used1->_packages_in($used1->_pm_files)], ['My::Test']); is_deeply([$used1->_packages_in($used1->_pm_files_in_test)], ['My::Test2']); $used1->_get_packages; is_deeply($used1->{exclude_in_testdir}, ['Test::Module::Used', 'My::Test', 'My::Test2']); is_deeply($used1->{exclude_in_libdir}, ['My::Test']); done_testing; 010_test_myself2.t100755000765000024 17012434114771 20203 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; my $used = Test::Module::Used->new(); $used->ok; 011_read_meta_json.t100755000765000024 65112434114771 20542 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::More; use Test::Module::Used; use File::Spec::Functions qw(catfile); my $used = Test::Module::Used->new( meta_file => catfile('testdata', 'META.json'), ); $used->_read_meta(); is_deeply( [$used->_build_requires()], ['ExtUtils::MakeMaker', 'Test::More'] ); is_deeply( [$used->_requires()], ['Module::Used', 'PPI::Document'] ); done_testing; 012_used_ok.t100755000765000024 64412434114771 17224 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; use File::Spec::Functions qw(catdir catfile); my $used = Test::Module::Used->new( test_dir => [catdir('testdata', 't')], lib_dir => [catdir('testdata', 'lib')], meta_file => catfile('testdata', 'META4.yml'), ); # Plack is required in META.yml4 but not used in testdata/lib/SampleModule.pm and It's ok in used_ok() $used->used_ok(); 013_requires_ok.t100755000765000024 56312434114771 20124 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; use File::Spec::Functions qw(catdir catfile); my $used = Test::Module::Used->new( test_dir => [catdir('testdata', 't')], lib_dir => [catdir('testdata', 'lib')], meta_file => catfile('testdata', 'META5.yml'), ); # Module::Used is missing in META.yml but it's ok $used->requires_ok(); 014_requires_ok_fail.t100755000765000024 142112434114771 21132 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Builder::Tester; use Test::Module::Used; use File::Spec::Functions qw(catdir catfile); use Test::Builder; use Test::More; my $used = Test::Module::Used->new( test_dir => [catdir('testdata', 't')], lib_dir => [catdir('testdata', 'lib')], meta_file => catfile('testdata', 'META4.yml'), ); test_out("1..4"); test_out("ok 1 - check required module: Module::Used"); test_out("not ok 2 - check required module: Plack"); test_out("ok 3 - check required module: Test::Module::Used"); test_out("ok 4 - check required module: Test::Class"); $used->requires_ok(); my $builder = Test::Builder->new(); $builder->reset;# reset because plan is automatically set in Test::Module::Used. test_test(skip_err=>1); done_testing; 015_used_ok_fail.t100755000765000024 131712434114771 20240 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; use File::Spec::Functions qw(catdir catfile); use Test::Builder::Tester; use Test::Builder; use Test::More; my $used = Test::Module::Used->new( test_dir => [catdir('testdata', 't')], lib_dir => [catdir('testdata', 'lib')], meta_file => catfile('testdata', 'META5.yml'), ); test_out("1..3"); test_out("not ok 1 - check used module: Module::Used"); test_out("ok 2 - check used module: Test::Module::Used"); test_out("ok 3 - check used module: Test::Class"); $used->used_ok(); my $builder = Test::Builder->new(); $builder->reset;# reset because plan is automatically set in Test::Module::Used. test_test(skip_err=>1); done_testing; 016_ok_fail1.t100755000765000024 165112434114771 17303 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Builder::Tester; use Test::Module::Used; use File::Spec::Functions qw(catdir catfile); use Test::Builder; use Test::More; my $used = Test::Module::Used->new( test_dir => [catdir('testdata', 't')], lib_dir => [catdir('testdata', 'lib')], meta_file => catfile('testdata', 'META4.yml'), ); test_out("1..7"); test_out("ok 1 - check used module: Module::Used"); test_out("ok 2 - check used module: Test::Module::Used"); test_out("ok 3 - check used module: Test::Class"); test_out("ok 4 - check required module: Module::Used"); test_out("not ok 5 - check required module: Plack"); test_out("ok 6 - check required module: Test::Module::Used"); test_out("ok 7 - check required module: Test::Class"); $used->ok(); my $builder = Test::Builder->new(); $builder->reset;# reset because plan is automatically set in Test::Module::Used. test_test(skip_err=>1); done_testing; 017_ok_fail2.t100755000765000024 147712434114771 17313 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/t#!/usr/bin/perl -w use strict; use warnings; use Test::Module::Used; use File::Spec::Functions qw(catdir catfile); use Test::Builder::Tester; use Test::Builder; use Test::More; my $used = Test::Module::Used->new( test_dir => [catdir('testdata', 't')], lib_dir => [catdir('testdata', 'lib')], meta_file => catfile('testdata', 'META5.yml'), ); test_out("1..5"); test_out("not ok 1 - check used module: Module::Used"); test_out("ok 2 - check used module: Test::Module::Used"); test_out("ok 3 - check used module: Test::Class"); test_out("ok 4 - check required module: Test::Module::Used"); test_out("ok 5 - check required module: Test::Class"); $used->ok(); my $builder = Test::Builder->new(); $builder->reset;# reset because plan is automatically set in Test::Module::Used. test_test(skip_err=>1); done_testing; META.json100644000765000024 203412434114771 20023 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata{ "resources" : { "license" : [ "http://dev.perl.org/licenses/" ] }, "generated_by" : "Module::Build version 0.36", "meta-spec" : { "version" : "2", "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec" }, "version" : "0.01", "name" : "Some-Module", "dynamic_config" : 1, "author" : [ "Someone" ], "release_status" : "stable", "license" : [ "perl_5" ], "description" : "testdata", "keywords" : [ "cpan" ], "prereqs" : { "runtime" : { "requires" : { "Module::Used" : "0", "PPI::Document" : "0" } }, "build" : { "requires" : { "ExtUtils::MakeMaker" : "6.42", "Test::More" : "0" } }, "test" : { "requires" : { "Test::More" : "0.88", "Test::Requires" : "1.2" } } }, "abstract" : "test data" }META.yml100644000765000024 112112434114771 17647 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata--- abstract: 'Test dependency between module and META.yml' author: - 'Takuya Tsuchida tsucchi@cpan.org' build_requires: ExtUtils::MakeMaker: 6.42 Test::More: 0.88 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-Module-Used no_index: directory: - inc - t - xt requires: Module::Used: 0 PPI::Document: 0 perl: 5.8.0 resources: license: http://dev.perl.org/licenses/ version: 0.0.1 META2.yml100644000765000024 114712434114771 17741 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata--- abstract: 'Test dependency between module and META.yml' author: - 'Takuya Tsuchida tsucchi@cpan.org' build_requires: ExtUtils::MakeMaker: 6.42 Test::More: 0.88 Test::Class: 0 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-Module-Used no_index: directory: - inc - t - xt requires: Module::Used: 0 Test::Module::Used: 0 perl: 5.8.0 resources: license: http://dev.perl.org/licenses/ version: 0.0.1 META3.yml100644000765000024 104012434114771 17732 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata--- abstract: 'write description here' author: - 'Takuya Tsuchida Etakuya.tsuchida@gmail.com' build_requires: ExtUtils::MakeMaker: 6.42 Test::More: 0.88 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: My-Test no_index: directory: - inc - t - xt requires: perl: 5.8.0 resources: license: http://dev.perl.org/licenses/ version: 0.0.1 META4.yml100644000765000024 116212434114771 17740 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata--- abstract: 'Test dependency between module and META.yml' author: - 'Takuya Tsuchida tsucchi@cpan.org' build_requires: ExtUtils::MakeMaker: 6.42 Test::More: 0.88 Test::Class: 0 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-Module-Used no_index: directory: - inc - t - xt requires: Module::Used: 0 Test::Module::Used: 0 Plack: 0 perl: 5.8.0 resources: license: http://dev.perl.org/licenses/ version: 0.0.1 META5.yml100644000765000024 112512434114771 17740 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata--- abstract: 'Test dependency between module and META.yml' author: - 'Takuya Tsuchida tsucchi@cpan.org' build_requires: ExtUtils::MakeMaker: 6.42 Test::More: 0.88 Test::Class: 0 configure_requires: ExtUtils::MakeMaker: 6.42 distribution_type: module generated_by: 'Module::Install version 0.91' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-Module-Used no_index: directory: - inc - t - xt requires: Test::Module::Used: 0 perl: 5.8.0 resources: license: http://dev.perl.org/licenses/ version: 0.0.1 SampleModule.pm100755000765000024 24312434114771 22060 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata/libpackage SampleModule; use Net::FTP; #core use Module::Used;#not core use Test::Module::Used;#not core use 5.00803;# perl version sub do_nothing {} 1; Test.pm100755000765000024 102312434114771 21074 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata/lib2/Mypackage My::Test; use strict; use warnings; our $VERSION = "0.2.6"; #use 5.008; =head1 NAME My::Test - write description here =head1 SYNOPSIS write synopsis here =head1 DESCRIPTION write description here =cut 1; __END__ =head1 AUTHOR Takuya Tsuchida Etakuya.tsuchida@gmail.com =head1 SEE ALSO write here if related module exists =head1 REPOSITORY write source code repository =head1 LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 001_test.t100644000765000024 11612434114771 20350 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata/t#!/usr/bin/perl -w use Test::More; use Test::Class; use SampleModule; ok(1); 001_use_ok.t100755000765000024 15112434114771 20742 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata/t2#!/usr/bin/perl use Test::More; use strict; use warnings; BEGIN { use_ok('My::Test') }; done_testing(); Test2.pm100755000765000024 6012434114771 21361 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6/testdata/t2/lib/Mypackage My::Test2; use List::MoreUtils; 1; META.yml100644000765000024 215612434114771 16047 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6--- abstract: 'Test required module is really used and vice versa between lib/t and META.yml' author: - 'Takuya Tsuchida ' build_requires: ExtUtils::MakeMaker: '6.59' Test::Builder::Tester: '0' Test::More: '0.98' configure_requires: Module::Build: '0.38' dynamic_config: 0 generated_by: 'Minilla/v2.1.1, CPAN::Meta::Converter version 2.141170' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-Module-Used no_index: directory: - testdata - t - xt - inc - share - eg - examples - author - builder provides: Test::Module::Used: file: lib/Test/Module/Used.pm version: v0.2.6 requires: CPAN::Meta: '0' List::MoreUtils: '0' Module::CoreList: '0' Module::Used: '0' PPI::Document: '0' perl: '5.008001' version: '0.77' resources: bugtracker: https://github.com/tsucchi/Test-Module-Used/issues homepage: https://github.com/tsucchi/Test-Module-Used repository: git://github.com/tsucchi/Test-Module-Used.git version: 0.2.6 x_contributors: - 'CPAN Service ' MANIFEST100644000765000024 124712434114771 15727 0ustar00tsucchistaff000000000000Test-Module-Used-0.2.6Build.PL Changes LICENSE META.json README.md cpanfile lib/Test/Module/Used.pm minil.toml t/001_use_ok.t t/002_default.t t/003_option.t t/004_used_ok.t t/005_used_module.t t/006_read_meta_yml.t t/007_test_myself.t t/008_test_is_empty.t t/009_auto_get_exclude.t t/010_test_myself2.t t/011_read_meta_json.t t/012_used_ok.t t/013_requires_ok.t t/014_requires_ok_fail.t t/015_used_ok_fail.t t/016_ok_fail1.t t/017_ok_fail2.t testdata/META.json testdata/META.yml testdata/META2.yml testdata/META3.yml testdata/META4.yml testdata/META5.yml testdata/lib/SampleModule.pm testdata/lib2/My/Test.pm testdata/t/001_test.t testdata/t2/001_use_ok.t testdata/t2/lib/My/Test2.pm META.yml MANIFEST