CONTRIBUTING000664001750001750 614612414307051 14313 0ustar00taitai000000000000Test-Modern-0.013NAME CONTRIBUTING DESCRIPTION If you're reading this document, that means you might be thinking about helping me out with this project. Thanks! Here's some ways you could help out: * Bug reports Found a bug? Great! (Well, not so great I suppose.) The place to report them is . Don't e-mail me about it, as your e-mail is more than likely to get lost amongst the spam. An example script clearly demonstrating the bug (preferably written using Test::More) would be greatly appreciated. * Patches If you've found a bug and written a fix for it, even better! Generally speaking you should check out the latest copy of the code from the source repository rather than using the CPAN distribution. The file META.yml should contain a link to the source repository. If not, then try or submit a bug report. (As far as I'm concerned the lack of a link is a bug.) Many of my distributions are also mirrored at . To submit the patch, do a pull request on GitHub or Bitbucket, or attach a diff file to a bug report. Unless otherwise stated, I'll assume that your contributions are licensed under the same terms as the rest of the project. (If using git, feel free to work in a branch. For Mercurial, I'd prefer bookmarks within the default branch.) * Documentation If there's anything unclear in the documentation, please submit this as a bug report or patch as above. Non-toy example scripts that I can bundle would also be appreciated. * Translation Translations of documentation would be welcome. For translations of error messages and other strings embedded in the code, check with me first. Sometimes the English strings may not in a stable state, so it would be a waste of time translating them. Coding Style I tend to write using something approximating the Allman style, using tabs for indentation and Unix-style line breaks. * * I nominally encode all source files as UTF-8, though in practice most of them use a 7-bit-safe ASCII-compatible subset of UTF-8. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE Copyright (c) 2012-2014 by Toby Inkster. CONTRIBUTING is available under three different licences permitting its redistribution: the CC-BY-SA_UK-2.0 licence, plus the same licences as Perl itself, which is distributed under the GNU General Public Licence version 1, and the Artistic Licence. This file is licensed under the Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales License. To view a copy of this license, visit . This file is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. COPYRIGHT000664001750001750 250212414307051 13744 0ustar00taitai000000000000Test-Modern-0.013Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Test-Modern Upstream-Contact: Toby Inkster (TOBYINK) Source: https://metacpan.org/release/Test-Modern Files: README lib/Test/Modern.pm t/01basic.t t/02exporting.t t/03extended.t t/04requires.t t/05warnings.t t/06class-api-ok.t t/07deep.t t/08object-ok.t t/09requires-perl.t t/10namespaces-clean.t t/11without.t t/12pod.t t/13versions.t t/14shouldntwarn.t t/15tlib.t t/16bench.t t/lib/Local/Foo.pm Copyright: This software is copyright (c) 2014 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: Changes META.json META.yml dist.ini doap.ttl Copyright: Copyright 2014 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: CONTRIBUTING INSTALL LICENSE Copyright: Unknown License: Unknown Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000664001750001750 22612414307043 13453 0ustar00taitai000000000000Test-Modern-0.013Maintainer: - Toby Inkster (TOBYINK) Thanks: - Andreas Vögele (VOEGELAS) - Paul Howarth Changes000664001750001750 672312414307043 13756 0ustar00taitai000000000000Test-Modern-0.013Test-Modern =========== Created: 2014-03-07 Home page: Bug tracker: Maintainer: Toby Inkster (TOBYINK) 0.013 2014-10-05 [ Packaging ] - Add 'test recommends' dependencies on a few modules. 0.012 2014-09-30 - does_ok no longer calls the internal Test::Builder `_try` method. 0.011 2014-09-17 - version_all_same now copes better with undef versions. 0.010 2014-07-17 [ Bug Fixes ] - Fix the behaviour of the BAIL_OUT called within object_ok. 0.009 2014-07-04 - Added: Implement an `-internet` feature allowing test scripts to declare they need access to the Internet. This honours the NO_NETWORK_TESTS environment variable. - Precautionary bypassing of prototype for internal calls to `Test::More::subtest`. - Updated: Improved `namespaces_clean` implementation along the same lines as recent changes to Test::CleanNamespaces. 0.008 2014-06-19 [ Packaging ] - Package with a newer Dist::Inkt to provide a better Makefile.PL (copes better with missing CPAN::Meta::Requirements). 0.007 2014-04-10 [ Bug Fixes ] - Fix for warnings being generated deep in the bowels of File::Spec. Fixes RT#94383. Andreas Vögele++ Paul Howarth++ 0.006 2014-04-02 - Added: EXPERIMENTALLY provide Test::Lib-like behaviour, and a related -lib export tag. - Added: Support an environment variable PERL_TEST_MODERN_ALLOW_WARNINGS to allow end-users to skip running end warnings tests. - Added: shouldnt_warn function. 0.005 2014-03-25 - Support Perl 5.6.1+. 0.004 2014-03-25 [ Documentation ] - Mention -without in the EXPORT section of the pod. [ Other ] - Added: EXPERIMENTALLY provide Test::Pod functions. - Added: EXPERIMENTALLY provide Test::Pod::Coverage functions. - Added: EXPERIMENTALLY provide Test::Version functions. - Improve the implementation of -without, including better compatibility with pre-5.12 versions of Perl. 0.003 2014-03-24 - Added: Provide a Test::Without::Module-like feature (-without). - Load IO::File and IO::Handle like Modern::Perl does. 0.002 2014-03-14 - No longer use superclass.pm. - Updated: Use Test::API 0.004 which provides its own copy of class_api_ok(), so Test::Modern no longer has to provide it. 0.001 2014-03-12 Initial release [ Documentation ] - Change module abstract. - Update SEE ALSO links. 0.000_09 2014-03-11 Preview [ Documentation ] - Add SEE ALSO link to Test::CleanNamespaces. - Add introductory paragraphs to several sections. - Minor formatting improvements. 0.000_08 2014-03-11 Preview - Added: -requires => { perl => $version } - Added: namespaces_clean, inspired by Test::CleanNamespaces - Added: object_ok now has a `clean` test. - Use superclass.pm. 0.000_07 2014-03-10 Preview - Added: object_ok now has a `more` test. - object_ok will now BAIL_OUT(!!) if you pass unknown hash keys in %tests. 0.000_06 2014-03-09 Preview [ Test Suite ] - Help Perl 5.8 pass the t/08object-ok.t test case. 0.000_05 2014-03-09 Preview - Added: Added an object_ok test function. 0.000_04 2014-03-08 Preview [ Bug Fixes ] - Fix error messages related to Test::Modern::_TD::DESTROY getting called in global cleanup. 0.000_03 2014-03-07 Preview - Added: Also export functions from Test::Deep. 0.000_02 2014-03-07 Preview - Added: Also export functions from Test::LongString. 0.000_01 2014-03-07 Preview INSTALL000664001750001750 166512414307040 13511 0ustar00taitai000000000000Test-Modern-0.013 Installing Test-Modern should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm Test::Modern If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S Test::Modern INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Test::Modern MANUAL INSTALLATION As a last resort, you can manually install it. Download the tarball and unpack it. Consult the file META.json for a list of pre-requisites. Install these first. To build Test-Modern: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install LICENSE000664001750001750 4365512414307041 13513 0ustar00taitai000000000000Test-Modern-0.013This software is copyright (c) 2014 by Toby Inkster. 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 Toby Inkster. 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, Fifth Floor, Boston, MA 02110-1301 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 Toby Inkster. 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 MANIFEST000664001750001750 63312414307051 13565 0ustar00taitai000000000000Test-Modern-0.013CONTRIBUTING COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/Test/Modern.pm t/01basic.t t/02exporting.t t/03extended.t t/04requires.t t/05warnings.t t/06class-api-ok.t t/07deep.t t/08object-ok.t t/09requires-perl.t t/10namespaces-clean.t t/11without.t t/12pod.t t/13versions.t t/14shouldntwarn.t t/15tlib.t t/16bench.t t/lib/Local/Foo.pm META.json000664001750001750 521712414307051 14100 0ustar00taitai000000000000Test-Modern-0.013{ "abstract" : "precision testing for modern perl", "author" : [ "Toby Inkster (TOBYINK) " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.140640", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-Modern", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "recommends" : { "CPAN::Meta::Requirements" : "2.000" }, "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "develop" : { "suggests" : { "Dist::Inkt::Profile::TOBYINK" : "0.023" } }, "runtime" : { "recommends" : { "Test::LongString" : "0.15" }, "requires" : { "Exporter::Tiny" : "0.030", "Import::Into" : "1.002000", "Module::Runtime" : "0.012", "Test::API" : "0.004", "Test::Deep" : "0.111", "Test::Fatal" : "0.007", "Test::More" : "0.96", "Test::Warnings" : "0.009", "Try::Tiny" : "0.15", "perl" : "5.006001" }, "suggests" : { "Test::Pod" : "0", "Test::Pod::Coverage" : "0", "Test::Version" : "0" } }, "test" : { "conflicts" : { "Local::I::Doubt::This::Exists::Either" : "0", "Local::This::Probably::Does::Not::Exist" : "0", "Moose::This::Should::Not::Be::A::Real::Package" : "0" }, "recommends" : { "LWP::UserAgent" : "0", "Moose" : "0", "namespace::clean" : "0" } } }, "provides" : { "Test::Modern" : { "file" : "lib/Test/Modern.pm", "version" : "0.013" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=Test-Modern" }, "homepage" : "https://metacpan.org/release/Test-Modern", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-test-modern.git", "web" : "https://github.com/tobyink/p5-test-modern" }, "x_identifier" : "http://purl.org/NET/cpan-uri/dist/Test-Modern/project" }, "version" : "0.013" } META.yml000664001750001750 225612414307051 13730 0ustar00taitai000000000000Test-Modern-0.013--- abstract: 'precision testing for modern perl' author: - 'Toby Inkster (TOBYINK) ' build_requires: {} configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.140640' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-Modern no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Test::Modern: file: lib/Test/Modern.pm version: '0.013' recommends: Test::LongString: '0.15' requires: Exporter::Tiny: '0.030' Import::Into: '1.002000' Module::Runtime: '0.012' Test::API: '0.004' Test::Deep: '0.111' Test::Fatal: '0.007' Test::More: '0.96' Test::Warnings: '0.009' Try::Tiny: '0.15' perl: '5.006001' resources: Identifier: http://purl.org/NET/cpan-uri/dist/Test-Modern/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=Test-Modern homepage: https://metacpan.org/release/Test-Modern license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-test-modern.git version: '0.013' Makefile.PL000664001750001750 1651712414307051 14456 0ustar00taitai000000000000Test-Modern-0.013use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "precision testing for modern perl", "author" => ["Toby Inkster (TOBYINK) "], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.140640", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "Test-Modern", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { recommends => { "CPAN::Meta::Requirements" => "2.000" }, requires => { "ExtUtils::MakeMaker" => 6.17 }, }, develop => { suggests => { "Dist::Inkt::Profile::TOBYINK" => 0.023 } }, runtime => { recommends => { "Test::LongString" => 0.15 }, requires => { "Exporter::Tiny" => "0.030", "Import::Into" => "1.002000", "Module::Runtime" => 0.012, "perl" => 5.006001, "Test::API" => 0.004, "Test::Deep" => 0.111, "Test::Fatal" => 0.007, "Test::More" => 0.96, "Test::Warnings" => 0.009, "Try::Tiny" => 0.15, }, suggests => { "Test::Pod" => 0, "Test::Pod::Coverage" => 0, "Test::Version" => 0 }, }, test => { conflicts => { "Local::I::Doubt::This::Exists::Either" => 0, "Local::This::Probably::Does::Not::Exist" => 0, "Moose::This::Should::Not::Be::A::Real::Package" => 0, }, recommends => { "LWP::UserAgent" => 0, "Moose" => 0, "namespace::clean" => 0 }, }, }, "provides" => { "Test::Modern" => { file => "lib/Test/Modern.pm", version => 0.013 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=Test-Modern" }, homepage => "https://metacpan.org/release/Test-Modern", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-test-modern.git", web => "https://github.com/tobyink/p5-test-modern", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/Test-Modern/project", }, "version" => 0.013, }; my %dynamic_config; for my $stage (keys %{$meta->{prereqs}}) { my $conflicts = $meta->{prereqs}{$stage}{conflicts} or next; eval { require CPAN::Meta::Requirements } or last; $conflicts = 'CPAN::Meta::Requirements'->from_string_hash($conflicts); for my $module ($conflicts->required_modules) { eval "require $module" or next; my $installed = eval(sprintf('$%s::VERSION', $module)); $conflicts->accepts_module($module, $installed) or next; my $message = "\n". "** This version of $meta->{name} conflicts with the version of\n". "** module $module ($installed) you have installed.\n"; die($message . "\n" . "Bailing out") if $stage eq 'build' || $stage eq 'configure'; $message .= "**\n". "** It's strongly recommended that you update it after\n". "** installing this version of $meta->{name}.\n"; warn("$message\n"); } } my %WriteMakefileArgs = ( ABSTRACT => $meta->{abstract}, AUTHOR => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]), DISTNAME => $meta->{name}, VERSION => $meta->{version}, EXE_FILES => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ], NAME => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n }, test => { TESTS => "t/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000664001750001750 4472712414307041 13367 0ustar00taitai000000000000Test-Modern-0.013NAME Test::Modern - precision testing for modern perl SYNOPSIS use Test::Modern; # Your tests here done_testing; DESCRIPTION Test::Modern provides the best features of Test::More, Test::Fatal, Test::Warnings, Test::API, Test::LongString, and Test::Deep, as well as ideas from Test::Requires, Test::DescribeMe, Test::Moose, and Test::CleanNamespaces. Test::Modern also automatically imposes strict and warnings on your script, and loads IO::File. (Much of the same stuff Modern::Perl does.) Although Test::Modern is a modern testing framework, it should run fine on pre-modern versions of Perl. It should be easy to install on Perl 5.8.9 and above; and if you can persuade its dependencies to install (not necessarily easy!), should be OK on anything back to Perl 5.6.1. Features from Test::More Test::Modern exports the following subs from Test::More: `ok($truth, $description)` `is($got, $expected, $description)` `isnt($got, $unexpected, $description)` `like($got, $regexp, $description)` `unlike($got, $regexp, $description)` `is_deeply($got, $expected, $description)` `cmp_ok($got, $operator, $expected, $description)` `new_ok($class, \@args, $name)` `isa_ok($object|$subclass, $class, $name)` `can_ok($object|$class, @methods)` `pass($description)` `fail($description)` `subtest($description, sub { ... })` `diag(@messages)` `note(@messages)` `explain(@messages)` `skip($why, $count) if $reason` `todo_skip($why, $count) if $reason` $TODO `plan(%plan)` `done_testing` `BAIL_OUT($reason)` The `use_ok`, `require_ok`, `eq_array`, `eq_hash`, and `eq_set` functions are also available, but not exported by default. For `use_ok` and `require_ok` it's normally better to use the Perl built-ins `use` and `require` which will die (failing your test) if things are not OK. For the `eq_*` functions, they can usually be replaced by `is_deeply`. Features from Test::Fatal Test::Modern exports the following subs from Test::Fatal: `exception { BLOCK }` Features from Test::Warnings Test::Modern exports the following subs from Test::Warnings: `warning { BLOCK }` `warnings { BLOCK }` In addition, Test::Modern always enables the `had_no_warnings` test at the end of the file, ensuring that your test script generated no warnings other than the expected ones which were caught by `warnings` blocks. (See also `PERL_TEST_MODERN_ALLOW_WARNINGS` in "ENVIRONMENT".) Test::Modern can also export an additional function for testing warnings, but does not export it by default: `shouldnt_warn { BLOCK }` Runs a block of code that will hopefully not warn, but might. Tests that it doesn't warn, but performs that test as a "todo" test, so if it fails, your test suite can still pass. Features from Test::API Test::Modern exports the following subs from Test::API: `public_ok($package, @functions)` `import_ok($package, export => \@functions, export_ok => \@functions)` `class_api_ok($class, @methods)` Features from Test::LongString Test::Modern exports the following subs from Test::LongString: `is_string($got, $expected, $description)` `is_string_nows($got, $expected, $description)` `like_string($got, $regexp, $description)` `unlike_string($got, $regexp, $description)` `contains_string($haystack, $needle, $description)` `lacks_string($haystack, $needle, $description)` Actually Test::Modern provides these via a wrapper. If Test::LongString is not installed then Test::Modern will provide a fallback implementation using Test::More's `is`, `isnt`, `like`, and `unlike` functions. (The diagnostics won't be as good in the case of failures.) Features from Test::Deep Test::Modern exports the following subs from Test::Deep: `cmp_deeply($got, $expected, $description)` The following are not exported by default, but can be exported upon request: `ignore()` `methods(%hash)` `listmethods(%hash)` `shallow($thing)` `noclass($thing)` `useclass($thing)` `re($regexp, $capture_data, $flags)` `superhashof(\%hash)` `subhashof(\%hash)` `bag(@elements)` `set(@elements)` `superbagof(@elements)` `subbagof(@elements)` `supersetof(@elements)` `subsetof(@elements)` `all(@expecteds)` `any(@expecteds)` `obj_isa($class)` `array_each($thing)` `str($string)` `num($number, $tolerance)` `bool($value)` `code(\&subref)` As an alternative to using those functions, Test::Modern exports a constant `TD` upon which you can call them as methods: # like Test::Deep::bag(@elements) TD->bag(@elements) Features from Test::Pod and Test::Pod::Coverage These features are currently considered experimental. They may be removed from a future version of Test::Modern. Test::Modern can export the following subs from Test::Pod and Test::Pod::Coverage, though they are not exported by default: `pod_file_ok($file, $description)` `all_pod_files_ok(@dirs)` `pod_coverage_ok($module, $params, $description)` `all_pod_coverage_ok($params, $description)` In fact, Test::Modern wraps these tests in checks to see whether Test::Pod(::Coverage) is installed, and the state of the `RELEASE_TESTING`, `AUTHOR_TESTING`, and `EXTENDED_TESTING` environment variables. If none of those environment variables is set to true, then the test is skipped altogether. If Test::Pod(::Coverage) is not installed, then the test is skipped, unless `RELEASE_TESTING` is true, in which case *Test::Pod(::Coverage) must be installed*. This is usually a pretty sensible behaviour. You want authors to be made aware of pod errors if possible. You want to make sure they are tested before doing a release. End users probably don't want a pod formatting error to prevent them from installing the software, unless they opt into it using `EXTENDED_TESTING`. Also, Test::Modern wraps the `all_*` functions to run them in a subtest (because otherwise they can interfere with your test plans). Features from Test::Version These features are currently considered experimental. They may be removed from a future version of Test::Modern. Test::Modern can export the following subs from Test::Version, though they are not exported by default: `version_ok($file, $description)` `version_all_ok(@dirs)` These are wrapped similarly to those described in the "Features from Test::Pod and Test::Coverage". Test::Modern can also export another sub based on `version_all_ok`: `version_all_same(@dirs)` Acts like `version_all_ok` but also checks that all modules have the same version number. Features inspired by Test::Moose Test::Modern does not use Test::Moose, but does provide the following function inspired by it: `does_ok($object|$subclass, $class, $name)` Like `isa_ok`, but calls `$obj->DOES` instead of `$obj->isa`. Features inspired by Test::CleanNamespaces Test::Modern does not use Test::CleanNamespaces, but does provide the following function inspired by it: `namespaces_clean(@namespaces)` Tests that namespaces don't contain any imported functions. (i.e. you haven't forgotten to use namespace::autoclean or namespace::sweep in a class). Unlike the version of this function supplied with Test::CleanNamespaces, if @namespaces contains more than one namespace, these will be run in a subtest, so the whole thing will only count as one test. Features inspired by Test::Benchmark Test::Modern does not use Test::Benchmark, but does provide the following feature inspired by it: `is_fastest($implementation, $times, \%implementations, $desc)` use Test::Modern qw( is_fastest ); is_fastest("speedy", -1, { "speedy" => sub { ... }, "slowcoach" => sub { ... }, }); This ensures that the named coderef runs the fastest out of a hashref of alternatives. The -1 parameter in the example is the number of times to run the coderefs (see Benchmark for more details, including how numbers less than zero are interpreted). Caveat: on fast computers, a set of coderefs that you might expect to differ in speed might all run in a negligible period of time, and thus be rounded to zero, in which case your test case could randomly fail. Use this test with caution! Caveat the second: these tests tend to be slow. Use sparingly. Because of the aforementioned caveats, it is a good idea to move your benchmarking tests into separate test scripts, keeping an imaginary wall between them and the bulk of your test suite (which tests correctness rather than speed). Test::Modern provides an import hint suitable for including at the top of these benchmarking tests to mark them as being primarily concerned with speed: use Test::Modern -benchmark; This will not only import the `is_fastest` function, but will also *skip the entire script* unless one of the `EXTENDED_TESTING` or `RELEASE_TESTING` environment variables is set. Features inspired by Test::Requires Test::Modern does not use Test::Requires, but does provide the following feature inspired by it: `use Test::Modern -requires => \%requirements` This will skip the entire test script if the requirements are not met. For example: use Test::Modern -requires => { 'perl' => '5.010', 'Moose' => '2.11', 'namespace::autoclean' => undef, }; Features inspired by Test::RequiresInternet Similarly you can skip the test script if an Internet connection is not available: use Test::Modern -internet; You can check for the ability to connect to particular hosts and ports: use Test::Modern -internet => [ 'www.example.com' => 'http', '8.8.8.8' => 53, ]; Test::Modern does not use Test::RequiresInternet but I've stolen much of the latter's implementation. Features inspired by Test::Without::Module Test::Modern does not use Test::Without::Module, but does provide the following feature inspired by it: `use Test::Modern -without => \@modules` This will run the tests as if the module was not installed. Useful for testing things in the absence of optional dependencies. For example: use Test::Modern -without => [ "Class::XSAccessor" ]; It cannot suppress modules from being loaded if they are required by Test::Modern itself. To get a list of what modules Test::Modern requires, run the following command: perl -MTest::Modern -le'print for sort keys %INC' (Note that the actual implementation is mostly stolen from Devel::Hide which seems to behave better than Test::Without::Module.) Features inspired by Test::DescribeMe These export tags allow you to classify tests as "author tests", "release tests", "extended tests", or "interactive tests". They will cause your test script to be skipped depending on various environment variables. `use Test::Modern -author` `use Test::Modern -release` `use Test::Modern -extended` `use Test::Modern -interactive` Features inspired by Test::Lib These features are currently considered experimental. They may be removed from a future version of Test::Modern. Test::Modern tries to find a directory called `t/lib` by traversing up the directory tree from the caller file. If found, this directory will be added to @INC. Test::Lib would croak if such a directory cannot be found. Test::Modern carries on if it can't find it. If you want something more like the Test::Lib behaviour, use the `-lib` import tag: use Test::Modern -lib; Brand Spanking New Features Test::Modern provides a shortcut which combines several features it has pilfered from other testing modules: `object_ok($object, $name, %tests)` Runs a gamut of subtests on an object: object_ok( $object, $name, isa => \@classes, does => \@roles, can => \@methods, api => \@methods, clean => $boolean, more => sub { my $object = shift; ...; } ); $object may be a blessed object, or an unblessed coderef which returns a blessed object. The `isa` test runs `isa_ok`; the `does` test runs `does_ok`, the `can` test runs `can_ok`, and the `api` test runs `class_api_ok`. `clean` allows you to run `namespaces_clean` on the object's class. `more` introduces a coderef for running more tests. Within this sub you can use any of the standard Test::More, Test::LongString, etc tests. It is automatically run in a `try` block (see Try::Tiny); throwing an exception will cause the test to fail, but not cause the script to end. Any of the test hash keys may be omitted, in which case that test will not be run. $name may be omitted. If the test succeeds, it returns the object (which may be useful for further tests). Otherwise, returns `undef`. Practical example: my $bob = object_ok( sub { Employee->new(name => 'Robert Jones') }, '$bob', isa => [qw( Employee Person Moo::Object )], does => [qw( Employable )], can => [qw( name employee_number tax_code )], clean => 1, more => sub { my $object = shift; is($object->name, "Robert Jones"); like($object->employee_number, qr/^[0-9]+$/); }, ); # make further use of $bob object_ok( sub { $bob->line_manager }, isa => [qw( Person )], ); EXPORT This module uses Exporter::Tiny to perform its exports. This allows exported subs to be renamed, etc. The following export tags are supported: `-more` Exports the "Features from Test::More", except deprecated ones. `-deprecated` Exports the deprecated Test::More features. `-fatal` Exports the "Features from Test::Fatal". `-warnings` Exports the "Features from Test::Warnings". `-api` Exports the "Features from Test::API", including `class_api_ok`. `-strings` Exports the "Features from Test::LongString". `-deep` Exports cmp_deeply and TD. `-deeper` Exports *all* the "Features from Test::Deep". `-moose` Exports the "Features inspired by Test::Moose". `-clean` Exports the "Features inspired by Test::CleanNamespaces". `-pod` Exports the "Features from Test::Pod and Test::Pod::Coverage". `-versions` Exports the "Features from Test::Version". `-default` Exports the default features -- all of the above except `-deprecated`, `-pod`, `-versions`, and `-deeper`. Also exports `object_ok`. `-all` Exports all of the above features *including* `-deprecated`, `-pod`, `-versions`, `-deeper`, `object_ok`, and `shouldnt_warn`. `-author`, `-extended`, `-interactive`, and `-release` Classify the test script. `-benchmark` The test script consists mostly of benchmarking. `-internet` The test script requires Internet access. `-requires`, `-without` Specify modules required or hidden for these test cases. `-lib` Makes the absence of a `t/lib` directory fatal. See "Features inspired by Test::Lib". `-verbose` Makes test output more verbose. (Currently only `is_faster` takes notice of this.) $TODO is currently *always* exported. ENVIRONMENT Test::Modern is affected by the following environment variables: `AUTHOR_TESTING`, `AUTOMATED_TESTING`, `EXTENDED_TESTING`, `RELEASE_TESTING` These variables affect the behaviour of Test::Modern's pod-checking and version-checking. See "Features from Test::Pod and Test::Coverage" and "Features from Test::Version". They also can trigger certain import tags to skip a test script. See "Features inspired by Test::DescribeMe", and "Features inspired by Test::Benchmark" `NO_NETWORK_TESTS` Automatically skips any tests which indicate that they require Internet access, without even checking to see if the Internet is accessible. See "Features inspired by Test::RequiresInternet". `PERL_TEST_MODERN_ALLOW_WARNINGS` Setting this to true allows you to disable Test::Warnings' end test. Normally the end test will cause a test script to fail if any unexpected warnings are encountered during its execution. New versions of Perl, and upgrades of dependencies can cause a previously good test suite to start emitting warnings. This environment variable can be used as a "quick fix" to get the test suite passing again. BUGS Please report any bugs to . SEE ALSO My Favourite Test::* Modules , Precision Testing for Modern Perl . Test::More, Test::Fatal, Test::Warnings, Test::API, Test::LongString, Test::Deep, Test::Moose, Test::CleanNamespaces, Test::Requires, Test::Without::Module, Test::RequiresInternet, Test::DescribeMe, Test::Lib, Test::Pod, Test::Pod::Coverage, Test::Version. Test::Most is a similar idea, but provides a slightly different combination of features. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. DISCLAIMER OF WARRANTIES 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. SIGNATURE000664001750001750 475612414307052 13753 0ustar00taitai000000000000Test-Modern-0.013This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 33317486c4fa2cf7fec85bf92ed38ac0f64233a0 CONTRIBUTING SHA1 728d10337e0d062c97234b9ed5f2fb43364e2e03 COPYRIGHT SHA1 30f135cee22a2ea09c954010878cdb8a14b37f6a CREDITS SHA1 d1305715ccdaa662de6f5c7ea9f18c8c2b6b0da3 Changes SHA1 d4299865e550b45b34d84ecb54890b954fb2b17f INSTALL SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE SHA1 bbbdb92b7a71d56058f201de47423bdd0520bad7 MANIFEST SHA1 983594bc4dfd1df5eeb5aab500a5c46a33109ca6 META.json SHA1 8ac3efce47aa49d30bab623be5ed3e3f79397f67 META.yml SHA1 ae7e67ec2d0472db686cfdadf6ea6bd52e51882c Makefile.PL SHA1 284c6f70735fa8075d5319860df2d2ea71d9fc37 README SHA1 ad423a5a6844ebd93aab03b47f4f178a559128ac dist.ini SHA1 74c762b1b7dc4af92a60496e8608ff630c088f4a doap.ttl SHA1 0ed094d3bf29001984cec0ef51d8c9f51388087c lib/Test/Modern.pm SHA1 70835456d741a13339c0cc7b9ab79fa5083308ac t/01basic.t SHA1 13281122d697dbb3c2b9b3c3ff00605b2f466d05 t/02exporting.t SHA1 69065d7899ae0fa85b44f539abefb20bc3d3721c t/03extended.t SHA1 ad1613a9399c8b6dd2ef8f38e070d38fed07ab15 t/04requires.t SHA1 c522863a10c9299821c169e7afd9a948c228ba6e t/05warnings.t SHA1 cc7771ca38ac16715c7c414cfeed10dd33084edf t/06class-api-ok.t SHA1 536c54c6500b3a5fb36650775ee3f9d7326d1287 t/07deep.t SHA1 e1ef4b81a4845291abb83a4a5dd7e7369afc44f5 t/08object-ok.t SHA1 74804dde1189a39af63080e134de392cf5b89c9d t/09requires-perl.t SHA1 7ce2974f913b0d68ba10dfbd5c61e219b55557ec t/10namespaces-clean.t SHA1 353c2c0a630df77b278e8ff76d8836f5e0745981 t/11without.t SHA1 5432ad34d118897e1d001875cd4ef63961aceda5 t/12pod.t SHA1 83d00cce325bcf1bbdd50b01c12ca3524f9c4c37 t/13versions.t SHA1 2a3615242d850b0555bf61da5377022124523952 t/14shouldntwarn.t SHA1 c7982555c6061515249ff4f8b00e44ef7eb0a1ea t/15tlib.t SHA1 a6959c96cf96ed1e9adbf391c226ae98a606d7dc t/16bench.t SHA1 8bda20158d26ee9ab2ba4aaa3ff84cfe0a9aede5 t/lib/Local/Foo.pm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlQxjioACgkQzr+BKGoqfTmHzgCeM8VnTyT0Yyez9+Gzy6TTYxmu rcwAoLYDzgyxCa9O3I2F1jVehOBUkVK8 =Kkvo -----END PGP SIGNATURE----- dist.ini000664001750001750 7512414307040 14056 0ustar00taitai000000000000Test-Modern-0.013;;class='Dist::Inkt::Profile::TOBYINK' ;;name='Test-Modern' doap.ttl000664001750001750 4774612414307051 14164 0ustar00taitai000000000000Test-Modern-0.013@prefix cpan-uri: . @prefix dc: . @prefix doap: . @prefix doap-bugs: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix rdfs: . @prefix xsd: . dc:title "the same terms as the perl 5 programming language system itself". a doap:Project; dc:contributor ; doap-deps:develop-suggestion [ doap-deps:on "Dist::Inkt::Profile::TOBYINK 0.023"^^doap-deps:CpanId; ]; doap-deps:runtime-recommendation [ doap-deps:on "Test::LongString 0.15"^^doap-deps:CpanId; ]; doap-deps:runtime-requirement [ doap-deps:on "Exporter::Tiny 0.030"^^doap-deps:CpanId; ], [ doap-deps:on "Import::Into 1.002000"^^doap-deps:CpanId; ], [ doap-deps:on "perl 5.006001"^^doap-deps:CpanId ], [ doap-deps:on "Module::Runtime 0.012"^^doap-deps:CpanId; ], [ doap-deps:on "Test::More 0.96"^^doap-deps:CpanId ], [ doap-deps:on "Test::Fatal 0.007"^^doap-deps:CpanId ], [ doap-deps:on "Test::API 0.004"^^doap-deps:CpanId ], [ doap-deps:on "Test::Deep 0.111"^^doap-deps:CpanId ], [ doap-deps:on "Test::Warnings 0.009"^^doap-deps:CpanId; ], [ doap-deps:on "Try::Tiny 0.15"^^doap-deps:CpanId ]; doap-deps:runtime-suggestion [ doap-deps:on "Test::Pod"^^doap-deps:CpanId ], [ doap-deps:on "Test::Pod::Coverage"^^doap-deps:CpanId; ], [ doap-deps:on "Test::Version"^^doap-deps:CpanId ]; doap-deps:test-conflict [ doap-deps:on "Local::This::Probably::Does::Not::Exist"^^doap-deps:CpanId; ], [ doap-deps:on "Local::I::Doubt::This::Exists::Either"^^doap-deps:CpanId; ], [ doap-deps:on "Moose::This::Should::Not::Be::A::Real::Package"^^doap-deps:CpanId; ]; doap-deps:test-recommendation [ doap-deps:on "Moose"^^doap-deps:CpanId ], [ doap-deps:on "namespace::clean"^^doap-deps:CpanId ], [ doap-deps:on "LWP::UserAgent"^^doap-deps:CpanId ]; doap:bug-database ; doap:created "2014-03-07"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "Test-Modern"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "precision testing for modern perl". a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_01"^^xsd:string; dc:issued "2014-03-07"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_01"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_02"^^xsd:string; dc:issued "2014-03-07"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Also export functions from Test::LongString."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_02"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_03"^^xsd:string; dc:issued "2014-03-07"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Also export functions from Test::Deep."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_03"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_04"^^xsd:string; dc:issued "2014-03-08"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix error messages related to Test::Modern::_TD::DESTROY getting called in global cleanup."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_04"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_05"^^xsd:string; dc:issued "2014-03-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Added an object_ok test function."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_05"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_06"^^xsd:string; dc:issued "2014-03-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Tests; rdfs:label "Help Perl 5.8 pass the t/08object-ok.t test case."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_06"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_07"^^xsd:string; dc:issued "2014-03-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "object_ok now has a `more` test."; ], [ a doap-changeset:Change; rdfs:label "object_ok will now BAIL_OUT(!!) if you pass unknown hash keys in %tests."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_07"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_08"^^xsd:string; dc:issued "2014-03-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "object_ok now has a `clean` test."; ], [ a doap-changeset:Addition; rdfs:label "-requires => { perl => $version }"; ], [ a doap-changeset:Change; rdfs:label "Use superclass.pm."; ], [ a doap-changeset:Addition; rdfs:label "namespaces_clean, inspired by Test::CleanNamespaces"; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_08"^^xsd:string. a cpan-uri:DeveloperRelease, doap:Version; rdfs:label "Preview"; dc:identifier "Test-Modern-0.000_09"^^xsd:string; dc:issued "2014-03-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Minor formatting improvements."; ], [ a doap-changeset:Documentation; rdfs:label "Add introductory paragraphs to several sections."; ], [ a doap-changeset:Documentation; rdfs:label "Add SEE ALSO link to Test::CleanNamespaces."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.000_09"^^xsd:string. a doap:Version; rdfs:label "Initial release"; dc:identifier "Test-Modern-0.001"^^xsd:string; dc:issued "2014-03-12"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Update SEE ALSO links."; ], [ a doap-changeset:Documentation; rdfs:label "Change module abstract."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.001"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.002"^^xsd:string; dc:issued "2014-03-14"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Use Test::API 0.004 which provides its own copy of class_api_ok(), so Test::Modern no longer has to provide it."; ], [ a doap-changeset:Change; rdfs:label "No longer use superclass.pm."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.002"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.003"^^xsd:string; dc:issued "2014-03-24"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Load IO::File and IO::Handle like Modern::Perl does."; ], [ a doap-changeset:Addition; rdfs:label "Provide a Test::Without::Module-like feature (-without)."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.003"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.004"^^xsd:string; dc:issued "2014-03-25"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Improve the implementation of -without, including better compatibility with pre-5.12 versions of Perl."; ], [ a doap-changeset:Addition; rdfs:label "EXPERIMENTALLY provide Test::Pod functions."; ], [ a doap-changeset:Addition; rdfs:label "EXPERIMENTALLY provide Test::Pod::Coverage functions."; ], [ a doap-changeset:Addition; rdfs:label "EXPERIMENTALLY provide Test::Version functions."; ], [ a doap-changeset:Documentation; rdfs:label "Mention -without in the EXPORT section of the pod."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.004"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.005"^^xsd:string; dc:issued "2014-03-25"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Support Perl 5.6.1+."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.005"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.006"^^xsd:string; dc:issued "2014-04-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "EXPERIMENTALLY provide Test::Lib-like behaviour, and a related -lib export tag."; ], [ a doap-changeset:Addition; rdfs:label "Support an environment variable PERL_TEST_MODERN_ALLOW_WARNINGS to allow end-users to skip running end warnings tests."; ], [ a doap-changeset:Addition; rdfs:label "shouldnt_warn function."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.006"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.007"^^xsd:string; dc:issued "2014-04-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix for warnings being generated deep in the bowels of File::Spec."; doap-changeset:fixes ; doap-changeset:thanks , ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.007"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.008"^^xsd:string; dc:issued "2014-06-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Package with a newer Dist::Inkt to provide a better Makefile.PL (copes better with missing CPAN::Meta::Requirements)."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.008"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.009"^^xsd:string; dc:issued "2014-07-04"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Implement an `-internet` feature allowing test scripts to declare they need access to the Internet. This honours the NO_NETWORK_TESTS environment variable."; ], [ a doap-changeset:Update; rdfs:label "Improved `namespaces_clean` implementation along the same lines as recent changes to Test::CleanNamespaces."; ], [ a doap-changeset:Change; rdfs:label "Precautionary bypassing of prototype for internal calls to `Test::More::subtest`."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.009"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.010"^^xsd:string; dc:issued "2014-07-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix the behaviour of the BAIL_OUT called within object_ok."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.010"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.011"^^xsd:string; dc:issued "2014-09-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "version_all_same now copes better with undef versions."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.011"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.012"^^xsd:string; dc:issued "2014-09-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "does_ok no longer calls the internal Test::Builder `_try` method."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.012"^^xsd:string. a doap:Version; dc:identifier "Test-Modern-0.013"^^xsd:string; dc:issued "2014-10-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Add 'test recommends' dependencies on a few modules."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.013"^^xsd:string. a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; foaf:nick "TOBYINK"; foaf:page . a foaf:Person; foaf:name "Andreas Vögele"; foaf:nick "VOEGELAS"; foaf:page , . a doap-bugs:Issue; doap-bugs:id "94383"^^xsd:string; doap-bugs:page . foaf:mbox ; foaf:name "Paul Howarth"; foaf:page . 01basic.t000664001750001750 67412414307040 14311 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern compiles. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use strict; use warnings; use Test::More; require_ok('Test::Modern'); done_testing; 02exporting.t000664001750001750 335112414307040 15263 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's exports. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use strict; use warnings; use Test::More; use Test::Modern (); use Data::Dumper; sub exports_ok ($$$) { my $class = shift; my @args = @{ +shift }; my @expected = @{ +shift }; my %into; $class->import({ into => \%into }, @args); local $Test::Builder::Level = $Test::Builder::Level + 1; local $Data::Dumper::Terse = 1; local $Data::Dumper::Indent = 0; is_deeply( [ sort keys %into ], [ sort @expected ], sprintf("use Test::Modern %s", join q[, ], Dumper(@args)), ); } my @defaults = qw/ $TODO ok is isnt like unlike is_deeply cmp_ok new_ok isa_ok can_ok pass fail diag note explain subtest skip todo_skip plan done_testing BAIL_OUT exception warnings warning public_ok import_ok class_api_ok does_ok object_ok namespaces_clean is_string is_string_nows like_string unlike_string contains_string lacks_string cmp_deeply TD /; exports_ok( 'Test::Modern' => [], \@defaults, ); exports_ok( 'Test::Modern' => [ -moose ], [qw/ $TODO does_ok /], ); exports_ok( 'Test::Modern' => [qw/ -moose pass diag use_ok /], [qw/ $TODO does_ok pass diag use_ok /], ); exports_ok( 'Test::Modern' => [ -requires => { strict => undef } ], \@defaults, ); exports_ok( 'Test::Modern' => [ -requires => { strict => undef }, -moose ], [qw/ $TODO does_ok /], ); exports_ok( 'Test::Modern' => [ -requires => { strict => undef }, 'diag' ], [qw/ $TODO diag /], ); done_testing; 03extended.t000664001750001750 76712414307040 15035 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's C<< -extended >> feature. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 BEGIN { $ENV{EXTENDED_TESTING} = 0 }; use Test::Modern -extended; fail("This was supposed to be skipped!!!"); done_testing; 04requires.t000664001750001750 122212414307040 15100 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's C<< -requires >> feature. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern -requires => { 'Local::This::Probably::Does::Not::Exist' => 99.999, 'Local::I::Doubt::This::Exists::Either' => 999.999, 'Moose::This::Should::Not::Be::A::Real::Package' => 9999.999, }; fail("This was supposed to be skipped!!!"); done_testing; 05warnings.t000664001750001750 73512414307040 15062 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern enables warnings. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern; like( warning { my $x = 1 + undef }, qr/uninitialized/, 'found warning', ); done_testing; 06class-api-ok.t000664001750001750 107012414307040 15527 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Check Test::Modern's C function seems to work. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern; BEGIN { package XXX; use base 'Exporter::Tiny'; sub xxx { 42 } $INC{'XXX.pm'} = __FILE__; }; class_api_ok('XXX' => qw/ import mkopt_hash xxx /); done_testing; 07deep.t000664001750001750 123112414307040 14161 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Check that Test::Modern's weird Test::Deep support works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern; my $got1 = { foo => 1 }; my $got2 = { bar => 2 }; my $expected = { foo => 1, bar => 2 }; cmp_deeply($got1, TD->subhashof($expected), '$got1 subhashof $expected'); cmp_deeply($got2, TD->subhashof($expected), '$got2 subhashof $expected'); done_testing; 08object-ok.t000664001750001750 164612414307040 15134 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Check Test::Modern's C function seems to work. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern; BEGIN { package XXX; sub xxx { 1 } $INC{'XXX.pm'} = __FILE__; }; BEGIN { package YYY; our @ISA = 'XXX'; sub yyy { 2 } $INC{'YYY.pm'} = __FILE__; }; *UNIVERSAL::DOES = \&UNIVERSAL::isa unless exists(&UNIVERSAL::DOES); my $return = object_ok( sub { bless [], 'YYY' }, '$y', isa => 'YYY', does => [qw/ XXX YYY /], can => [qw/ xxx /], api => [qw/ xxx yyy /], clean => 1, more => sub { my $object = shift; is($object->xxx, 1); is($object->yyy, 2); }, ); isa_ok($return, 'YYY', '$return'); done_testing; 09requires-perl.t000664001750001750 101112414307040 16041 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's C<< -requires >> feature works with C<< "perl" >> as a requirement. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern -requires => { perl => 9 }; fail("This was supposed to be skipped!!!"); done_testing; 10namespaces-clean.t000664001750001750 204612414307040 16442 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's C<< namespaces_clean >> feature works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern -requires => { 'namespace::clean' => undef, 'Moose' => '2.0600', }; { package MyRole; sub xyz { 999 } } { package Foo; use Scalar::Util qw(refaddr); use namespace::clean; $INC{'Foo.pm'} = __FILE__; } { package Bar; use Moose; use Scalar::Util qw(blessed); use namespace::clean; use constant CONST => 42; use overload q[0+] => 'xyz'; $INC{'Bar.pm'} = __FILE__; sub xyz { 42 } } { package Baz; BEGIN { *xyz = \&MyRole::xyz }; sub DOES { my $self = shift; return !!1 if $_[0] eq 'MyRole'; return !!1 if $self->isa(@_); return !!0; } $INC{'Baz.pm'} = __FILE__; } namespaces_clean('Foo', 'Bar', 'Baz'); done_testing; 11without.t000664001750001750 123312414307040 14744 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's C<< -without >> feature works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern -without => [qw( CGI::Push LWP::UserAgent Net::NNTP )]; like( exception { require CGI::Push }, qr/^Can't locate/, ); like( exception { require LWP::UserAgent }, qr/^Can't locate/, ); like( exception { require Net::NNTP }, qr/^Can't locate/, ); done_testing; 12pod.t000664001750001750 106612414307040 14030 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's pod testing works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern qw( -more -pod ); pod_file_ok(__FILE__); all_pod_files_ok(); pod_coverage_ok("Test::Modern"); all_pod_coverage_ok(); done_testing( 4 + !$ENV{PERL_TEST_MODERN_ALLOW_WARNINGS} ); 13versions.t000664001750001750 104312414307040 15112 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's version testing works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern qw( -more -versions ); version_ok('lib/Test/Modern.pm'); version_all_ok(); version_all_same(); done_testing( 3 + !$ENV{PERL_TEST_MODERN_ALLOW_WARNINGS} ); 14shouldntwarn.t000664001750001750 104512414307040 15775 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern's C function works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern qw( -more shouldnt_warn ); shouldnt_warn { is(1, 1); is(2, 2); my $x = "hello"; my $y = 1 + $x; is(3, 3); is(4, 4); }; done_testing; 15tlib.t000664001750001750 77012414307040 14164 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test that Test::Modern automatically pushes C onto C<< @INC >>. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern qw( -lib -more use_ok ); use_ok('Local::Foo'); is( Local::Foo::bar(), 42 ); done_testing; 16bench.t000664001750001750 110012414307040 14316 0ustar00taitai000000000000Test-Modern-0.013/t=pod =encoding utf-8 =head1 PURPOSE Test Test::Modern's C. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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 use Test::Modern -benchmark; no warnings qw(recursion); sub fib { my $n = shift; $n<2 ? $n : fib($n-1)+fib($n-2); } is_fastest('fib_3', -1, { fib_3 => q{ fib(3) }, fib_13 => q{ fib(13) }, }); done_testing; Modern.pm000664001750001750 11454412414307040 15770 0ustar00taitai000000000000Test-Modern-0.013/lib/Testuse 5.006001; use strict; use warnings; package Test::Modern; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.013'; our $VERBOSE; use Cwd 0 qw(); use Exporter::Tiny 0.030 qw(); use File::Spec 0 qw(); use IO::File 1.08 qw(); use IO::Handle 1.21 qw(); use Import::Into 1.002 qw(); use Module::Runtime 0.012 qw( require_module module_notional_filename ); use Test::More 0.96; use Test::API 0.004; use Test::Fatal 0.007; use Test::Warnings 0.009 qw( warning warnings ), ($ENV{PERL_TEST_MODERN_ALLOW_WARNINGS} ? ':no_end_test' : ()); use Test::Deep 0.111 qw( :v1 ); use Try::Tiny 0.15 qw( try catch ); my %HINTS; $HINTS{ extended } = sub { return if $ENV{EXTENDED_TESTING}; plan skip_all => 'Not running extended tests'; }; $HINTS{ author } = sub { return if $ENV{AUTHOR_TESTING}; plan skip_all => 'Not running author tests'; }; $HINTS{ release } = sub { return if $ENV{RELEASE_TESTING}; plan skip_all => 'Not running release tests'; }; $HINTS{ interactive } = sub { return unless $ENV{AUTOMATED_TESTING}; plan skip_all => 'Not running interactive tests'; }; $HINTS{ requires } = sub { my %requires = %{ $_[2] }; for my $module (sort keys %requires) { if ($module eq 'perl') { next if !defined($requires{$module}); next if $] >= $requires{$module}; return plan skip_all => sprintf( "Test requires Perl %s", $requires{$module}, ); } try { &require_module( $module, defined($requires{$module}) ? $requires{$module} : (), ); } catch { plan skip_all => sprintf( "Test requires %s%s", $module, defined($requires{$module}) ? " $requires{$module}" : "", ); } } return; }; $HINTS{ lib } = sub { $_[3]{lib}++; () }; { my ($installed, %hide) = 0; # This implementation stolen from Devel::Hide. Keep the # Perl-5.6 compatible implementation, because one day it # might be nice if this module could support Perl 5.6. my $_scalar_as_io = ($] >= 5.008) ? sub { open(my($io), '<', \$_[0]) or die("Cannot open scalarref for IO?!"); return $io; } : sub { my $scalar = shift; require File::Temp; my $io = File::Temp::tempfile(); print {$io} $scalar; seek $io, 0, 0; # rewind the handle return $io; }; my $inc = sub { my (undef, $file) = @_; if ($hide{$file}) { my $oops = sprintf( qq{die "Can't locate %s (hidden by %s)\\n";}, $file, __PACKAGE__, ); return $_scalar_as_io->($oops); } return; }; $HINTS{ without } = sub { unless ($installed) { unshift(@INC, $inc); ++$installed; } my @without = @{ $_[2] }; for my $module (@without) { my $file = module_notional_filename($module); exists($INC{$file}) ? plan(skip_all => sprintf("cannot prevent $module from loading (it is already loaded)")) : ++$hide{$file}; } return; }; } { my $checker; $checker = sub { $checker = eval q{ package # Dummy::Test::RequiresInternet; use Socket; sub { my ($host, $port) = @_; my $portnum = ($port =~ /[^0-9]/) ? getservbyname($port, "tcp") : $port; die "Could not find a port number for $port\n" if not $portnum; my $iaddr = inet_aton($host) or die "no host: $host\n"; my $paddr = sockaddr_in($portnum, $iaddr); my $proto = getprotobyname("tcp"); socket(my $sock, PF_INET, SOCK_STREAM, $proto) or die "socket: $!\n"; connect($sock, $paddr) or die "connect: $!\n"; close($sock) or die "close: $!\n"; !!1; } }; goto($checker); }; $HINTS{ internet } = sub { plan skip_all => 'Not running network tests' if $ENV{NO_NETWORK_TESTING}; my $arg = $_[2]; my @hosts = ref($arg) eq q(HASH) ? %$arg : ref($arg) eq q(ARRAY) ? @$arg : ref($arg) eq q(SCALAR) ? ( $$arg => 80 ) : ( 'www.google.com' => 80 ); while (@hosts) { my ($host, $port) = splice(@hosts, 0, 2); defined($host) && defined($port) or BAIL_OUT("Expected host+port pair (not undef)"); eval { $checker->($host, $port); 1 } or plan skip_all => "$@"; } return; }; } $HINTS{ benchmark } = sub { return qw(is_fastest) if $ENV{RELEASE_TESTING} || $ENV{EXTENDED_TESTING}; plan skip_all => 'Not running benchmarks'; }; $HINTS{ verbose } = sub { $VERBOSE = 1; () }; our @ISA = qw(Exporter::Tiny); our %EXPORT_TAGS = ( more => [qw( ok is isnt like unlike is_deeply cmp_ok new_ok isa_ok can_ok pass fail diag note explain subtest skip todo_skip plan done_testing BAIL_OUT )], fatal => [qw( exception )], warnings => [qw( warnings warning )], api => [qw( public_ok import_ok class_api_ok )], moose => [qw( does_ok )], pod => [qw( pod_file_ok all_pod_files_ok pod_coverage_ok all_pod_coverage_ok )], versions => [qw( version_ok version_all_ok version_all_same )], strings => [qw( is_string is_string_nows like_string unlike_string contains_string lacks_string )], clean => [qw( namespaces_clean )], deep => [qw( cmp_deeply TD )], deeper => [qw( cmp_deeply TD ignore methods listmethods shallow noclass useclass re superhashof subhashof bag superbagof subbagof set supersetof subsetof all any obj_isa array_each str num bool code )], deprecated => [qw( use_ok require_ok eq_array eq_hash eq_set )], %HINTS, ); our @EXPORT_OK = ( 'object_ok', 'shouldnt_warn', 'is_fastest', map(@$_, grep { ref($_) eq 'ARRAY' } values(%EXPORT_TAGS)), ); our @EXPORT = ( 'object_ok', map(@{$EXPORT_TAGS{$_}}, qw(more fatal warnings api moose strings deep clean)), ); # Here we check to see if the import list consists # only of hints. If so, we add @EXPORT to the list. # This means that `use Test::Modern -extended;` # won't result in the standard exports getting # suppressed. # sub import { my $me = shift; my $symbols = grep { ref($_) ? 0 : # refs are not symbols /\A[:-](\w+)\z/ && $HINTS{$1} ? 0 : # hints are not symbols 1; # everything else is } @_; push @_, @EXPORT if $symbols == 0; my $globals = ref($_[0]) eq 'HASH' ? shift() : {}; $globals->{into_file} = (caller)[1] unless ref($globals->{into}); unshift @_, $me, $globals; goto \&Exporter::Tiny::import; } sub _exporter_validate_opts { my $me = shift; my ($opts) = @_; my $caller = $opts->{into}; # Exporter::Tiny can't handle exporting variables # at the moment. :-( # { no strict qw(refs); (ref($caller) ? $caller->{'$TODO'} : *{"$caller\::TODO"}) = \$Test::More::TODO; } return if ref $caller; 'strict'->import::into($caller); 'warnings'->import::into($caller); $me->_setup_inc($opts); } sub _setup_inc { shift; my ($opts) = @_; return unless exists($opts->{into_file}); my $dir = do { my ($v, $d) = 'File::Spec'->splitpath($opts->{into_file}); 'File::Spec'->catpath($v, $d, ''); }; my $found; LEVEL: for my $i (0..5) { my $t_dir = 'File::Spec'->catdir($dir, (('File::Spec'->updir) x $i), 't'); my $xt_dir = 'File::Spec'->catdir($dir, (('File::Spec'->updir) x $i), 'xt'); -d $t_dir or -d $xt_dir or next LEVEL; my $tlib_dir = 'File::Spec'->catdir($t_dir, 'lib'); if (-d $tlib_dir) { require lib; 'lib'->import(Cwd::abs_path $tlib_dir); $found++; } last LEVEL if $found; } if ($opts->{lib} and not $found) { BAIL_OUT("Expected to find directory t/lib!"); } } # Additional exports # sub does_ok ($$;$) # just a copy of Test::More::isa_ok { my( $thing, $class, $thing_name ) = @_; my $tb = Test::More->builder; my $whatami; if( !defined $thing ) { $whatami = 'undef'; } elsif( ref $thing ) { $whatami = 'reference'; local($@,$!); require Scalar::Util; if( Scalar::Util::blessed($thing) ) { $whatami = 'object'; } } else { $whatami = 'class'; } my ($rslt, $error); try { $rslt = $thing->DOES($class) } catch { $error = $_ }; if ($error) { die <DOES on your $whatami and got some weird error. Here's the error. $error WHOA } # Special case for isa_ok( [], "ARRAY" ) and like if( $whatami eq 'reference' ) { $rslt = UNIVERSAL::DOES($thing, $class); } my($diag, $name); if( defined $thing_name ) { $name = "'$thing_name' does '$class'"; $diag = defined $thing ? "'$thing_name' doesn't '$class'" : "'$thing_name' isn't defined"; } elsif( $whatami eq 'object' ) { my $my_class = ref $thing; $thing_name = qq[An object of class '$my_class']; $name = "$thing_name does '$class'"; $diag = "The object of class '$my_class' doesn't '$class'"; } elsif( $whatami eq 'reference' ) { my $type = ref $thing; $thing_name = qq[A reference of type '$type']; $name = "$thing_name does '$class'"; $diag = "The reference of type '$type' doesn't '$class'"; } elsif( $whatami eq 'undef' ) { $thing_name = 'undef'; $name = "$thing_name does '$class'"; $diag = "$thing_name isn't defined"; } elsif( $whatami eq 'class' ) { $thing_name = qq[The class (or class-like) '$thing']; $name = "$thing_name does '$class'"; $diag = "$thing_name doesn't '$class'"; } else { die; } my $ok; if($rslt) { $ok = $tb->ok( 1, $name ); } else { $ok = $tb->ok( 0, $name ); $tb->diag(" $diag\n"); } return $ok; } sub object_ok { local $Test::Builder::Level = $Test::Builder::Level + 1; my $object = shift; my $name = (@_%2) ? shift : '$object'; my %tests = @_; my $bail = !!0; my $result = &subtest("$name ok", sub { if (ref($object) eq q(CODE)) { try { my $tmp = $object->(); die 'coderef did not return an object' unless ref($tmp); $object = $tmp; pass("instantiate $name"); } catch { fail("instantiate $name"); diag("instantiating $name threw an exception: $_"); } } ok(Scalar::Util::blessed($object), "$name is blessed") or return; if (exists($tests{isa})) { my @classes = ref($tests{isa}) eq q(ARRAY) ? @{$tests{isa}} : $tests{isa}; isa_ok($object, $_, $name) for @classes; delete $tests{isa}; } if (exists($tests{does})) { my @roles = ref($tests{does}) eq q(ARRAY) ? @{$tests{does}} : $tests{does}; does_ok($object, $_, $name) for @roles; delete $tests{does}; } if (exists($tests{can})) { my @methods = ref($tests{can}) eq q(ARRAY) ? @{$tests{can}} : $tests{can}; can_ok($object, @methods); delete $tests{can}; } if (exists($tests{api})) { my @methods = ref($tests{api}) eq q(ARRAY) ? @{$tests{api}} : $tests{api}; class_api_ok(ref($object), @methods); delete $tests{api}; } if (delete($tests{clean})) { namespaces_clean(ref($object)); } if (exists($tests{more})) { my $more = delete $tests{more}; &subtest("more tests for $name", sub { my $exception = exception { $object->$more }; is($exception, undef, "no exception thrown by additional tests"); done_testing; }); } $bail = !!keys %tests; done_testing; }); if ($bail) { my $huh = join q[, ], sort keys %tests; BAIL_OUT("object_ok cannot understand: $huh"); } # return $object $result ? $object : (); } { my $wrap = sub { my @alts = @_; my $chosen; return sub { unless ($chosen) { ALT: for (@alts) { ref($_) and ($chosen = $_) and last ALT; my ($module, $sub) = /^(.+)::(\w+)$/; try { no strict qw(refs); no warnings qw(exiting); require_module($module); exists(&$_) ? (($chosen = \&$_) and last ALT) : die("no such sub $_"); } catch { diag("could not load $module: $_"); }; } } $chosen ? goto($chosen) : fail("$alts[0] not available - failing test!") }; }; *is_string = $wrap->( 'Test::LongString::is_string', 'Test::More::is', ); *is_string_nows = $wrap->( 'Test::LongString::is_string_nows', sub { my $got = shift; my $expected = shift; s/\s+//g for $got, $expected; unshift @_, $got, $expected; goto \&Test::More::is; }, ); *like_string = $wrap->( 'Test::LongString::like_string', 'Test::More::like', ); *unlike_string = $wrap->( 'Test::LongString::unlike_string', 'Test::More::unlike', ); *contains_string = $wrap->( 'Test::LongString::contains_string', sub { my $got = shift; my $expected = shift; unshift @_, $got, qr/\Q$expected\E/; goto \&Test::More::like; }, ); *lacks_string = $wrap->( 'Test::LongString::lacks_string', sub { my $got = shift; my $expected = shift; unshift @_, $got, qr/\Q$expected\E/; goto \&Test::More::unlike; }, ); } sub _generate_TD { my $_td = bless(do { my $x = 1; \$x }, 'Test::Modern::_TD'); return sub () { $_td }; } sub Test::Modern::_TD::AUTOLOAD { shift; my ($method) = ($Test::Modern::_TD::AUTOLOAD =~ /(\w+)\z/); return if $method eq 'DESTROY'; my $coderef = 'Test::Deep'->can($method) or die("Test::Deep::$method not found"); $coderef->(@_); } # Stolen from Test::CleanNamespaces; eliminated Package::Stash and # Sub::Name dependencies; massively cleaned up; don't use Test::Builder # directly; instead just call Test::More's exported functions. # { my $_dirt = sub { my $ns = shift; require_module($ns); my %symbols = do { no strict qw(refs); map { /([^:]+)$/; $1 => $_; } grep { eval { *$_{CODE} } } values %{"$ns\::"}; }; my @imports; my $meta; if ($INC{ module_notional_filename('Moose::Util') } and $meta = Moose::Util::find_meta($ns)) { my %subs = %symbols; delete @subs{ $meta->get_method_list }; @imports = keys %subs; } elsif ($INC{ module_notional_filename('Mouse::Util') } and $meta = Mouse::Util::class_of($ns)) { my %subs = %symbols; delete @subs{ $meta->get_method_list }; @imports = keys %subs; } else { require B; no strict qw(refs); @imports = grep { my $stash = B::svref_2object(\&{"$ns\::$_"})->GV->STASH->NAME; $stash ne $ns and $stash ne 'Role::Tiny' and not eval { require Role::Tiny; Role::Tiny->is_role($stash) } } keys %symbols; } my %imports; @imports{@imports} = map substr("$symbols{$_}", 1), @imports; # But really it's better to inherit these rather than import them. :-) if (keys %imports) { delete @imports{qw(import unimport)}; } if (keys %imports) { my @overloads = grep { /^\(/ or $imports{$_} eq 'overload::nil' } keys %imports; delete @imports{@overloads} if @overloads; } if (keys %imports and $] < 5.010) { my @constants = grep { $imports{$_} eq 'constant::__ANON__' } keys %imports; delete @imports{@constants} if @constants; } @imports = sort keys(%imports); my %sources; @sources{@imports} = map { B::svref_2object(\&{"$ns\::$_"})->GV->STASH->NAME; } @imports; my %does; for my $func (keys %sources) { my $role = $sources{$func}; $does{$role} = !!eval { $ns->DOES($role) } unless exists $does{$role}; delete $imports{$func} if $does{$role}; } sort keys(%imports); }; my $_diag_dirt = sub { require B; my $ns = shift; my @imports = @_; my %imports; @imports{@imports} = map { B::svref_2object(\&{"$ns\::$_"})->GV->STASH->NAME . "::$_"; } @imports; diag explain('remaining imports: ' => \%imports); }; my $_test_or_skip = sub { my $ns = shift; my $rv; try { my @imports = $ns->$_dirt; $rv = ok(!@imports, "${ns} contains no imported functions") or $ns->$_diag_dirt(@imports); } catch { SKIP: { skip "failed to load $ns: $_", 1; fail("failed to load module"); }; }; return $rv; }; sub namespaces_clean { local $Test::Builder::Level = $Test::Builder::Level + 1; # special case a single namespace return shift->$_test_or_skip if @_ == 1; my @namespaces = @_; return &subtest( sprintf("namespaces_clean: %s", join q(, ), @namespaces), sub { $_->$_test_or_skip for @namespaces; done_testing; }, ); } } # Release tests... { sub _should_extended_test () { $ENV{RELEASE_TESTING} || $ENV{AUTHOR_TESTING} || $ENV{EXTENDED_TESTING}; } sub _wrap { no strict qw(refs); my ($module, $function, %opt) = @_; my $code; ($function, $code) = each(%$function) if ref($function) eq q(HASH); *$function = sub { if ($opt{extended} and not _should_extended_test) { SKIP: { skip 'Not running extended tests', 1; pass("skipped"); } return 1; } if (eval "require $module") { $code ||= \&{"$module\::$function"}; if ($opt{multi}) { my @args = @_; @_ = ($function, sub { @_ = @args; goto $code; }); goto \&Test::More::subtest; } else { goto $code; } } local $Test::Builder::Level = $Test::Builder::Level + 1; SKIP: { skip "$module only required for release testing", 1 unless $ENV{RELEASE_TESTING}; fail("$function"); diag("$module not installed"); } return; }; } my $_VAS = sub { my ($dir, $name) = @_; $dir = defined $dir ? $dir : -d 'blib' ? 'blib' : 'lib'; return fail("$dir does not exist, or is not a directory") unless -d $dir; my @files = File::Find::Rule->perl_module->in($dir); $name ||= "all modules in $dir have the same version number"; local $Test::Builder::Level = $Test::Builder::Level + 1; &subtest($name => sub { my %versions; for my $file (@files) { Test::Version::version_ok($file) or next; my $info = Module::Metadata->new_from_file($file); my $ver = $info->version; $ver = '(undef)' unless defined $ver; push @{$versions{$ver}}, $file; } my $ok = keys(%versions) < 2; ok($ok, "single version number found"); if (!$ok) { diag("Files with version $_: @{$versions{$_}}") for sort keys(%versions); } done_testing; }); }; _wrap("Test::Pod", "pod_file_ok", extended => 1); _wrap("Test::Pod", "all_pod_files_ok", extended => 1, multi => 1); _wrap("Test::Pod::Coverage", "pod_coverage_ok", extended => 1); _wrap("Test::Pod::Coverage", "all_pod_coverage_ok", extended => 1, multi => 1); _wrap("Test::Version", "version_ok", extended => 1); _wrap("Test::Version", "version_all_ok", extended => 1, multi => 1); _wrap("Test::Version", { "version_all_same" => $_VAS }, extended => 1); } sub shouldnt_warn (&) { my @warnings = do { local $Test::Builder::Level = $Test::Builder::Level + 3; &Test::Warnings::warnings(@_); }; my $old = $TODO; $TODO = "shouldn't warn block"; local $Test::Builder::Level = $Test::Builder::Level + 1; ok(scalar(@warnings)==0, "no (unexpected) warnings"); diag("Saw warning: $_") for @warnings; $TODO = $old; } { # When passed a string of code, Benchmark::timethis() evaluates # it in the caller package; need to fake that. my $_do = sub { my $caller = shift; my $sub = shift; my $doer = eval qq[ package $caller; sub { ${sub}(\@_) } ]; $doer->(@_); }; my $get_res = sub { require Benchmark; require Scalar::Util; my ($caller, $times, $sub) = @_; Scalar::Util::blessed($sub) && $sub->isa("Benchmark") ? $sub : $caller->$_do('Benchmark::timethis', $times, $sub, "", "none"); }; sub is_fastest { require Benchmark; my $caller = caller; my ($which, $times, $marks, $desc) = @_; $desc = "$which is fastest" unless defined $desc; my @marks; while (my ($name, $sub) = each %$marks) { my $res = $get_res->($caller, $times, $sub); my ($r, $pu, $ps, $cu, $cs, $n) = @$res; push(@marks, { name => $name, res => $res, n => $n, s => ($pu+$ps), }); } @marks = sort {$b->{n} * $a->{s} <=> $a->{n} * $b->{s}} @marks; my $ok = $marks[0]->{name} eq $which; local $Test::Builder::Level = $Test::Builder::Level + 1; ok($ok, $desc); diag("$which was not the fastest") unless $ok; if ($VERBOSE or not $ok) { foreach my $mark (@marks) { diag("$mark->{name} - " . Benchmark::timestr($mark->{res})); } } $ok; } } 1; ## no Test::Tabs __END__ =pod =encoding utf-8 =for stopwords todo =head1 NAME Test::Modern - precision testing for modern perl =head1 SYNOPSIS use Test::Modern; # Your tests here done_testing; =head1 DESCRIPTION Test::Modern provides the best features of L, L, L, L, L, and L, as well as ideas from L, L, L, and L. Test::Modern also automatically imposes L and L on your script, and loads L. (Much of the same stuff L does.) Although Test::Modern is a modern testing framework, it should run fine on pre-modern versions of Perl. It should be easy to install on Perl 5.8.9 and above; and if you can persuade its dependencies to install (not necessarily easy!), should be OK on anything back to Perl 5.6.1. =head2 Features from Test::More Test::Modern exports the following subs from L: =over =item C<< ok($truth, $description) >> =item C<< is($got, $expected, $description) >> =item C<< isnt($got, $unexpected, $description) >> =item C<< like($got, $regexp, $description) >> =item C<< unlike($got, $regexp, $description) >> =item C<< is_deeply($got, $expected, $description) >> =item C<< cmp_ok($got, $operator, $expected, $description) >> =item C<< new_ok($class, \@args, $name) >> =item C<< isa_ok($object|$subclass, $class, $name) >> =item C<< can_ok($object|$class, @methods) >> =item C<< pass($description) >> =item C<< fail($description) >> =item C<< subtest($description, sub { ... }) >> =item C<< diag(@messages) >> =item C<< note(@messages) >> =item C<< explain(@messages) >> =item C<< skip($why, $count) if $reason >> =item C<< todo_skip($why, $count) if $reason >> =item C<< $TODO >> =item C<< plan(%plan) >> =item C<< done_testing >> =item C<< BAIL_OUT($reason) >> =back The C, C, C, C, and C functions are also available, but not exported by default. For C and C it's normally better to use the Perl built-ins C and C which will die (failing your test) if things are not OK. For the C<< eq_* >> functions, they can usually be replaced by C. =head2 Features from Test::Fatal Test::Modern exports the following subs from L: =over =item C<< exception { BLOCK } >> =back =head2 Features from Test::Warnings Test::Modern exports the following subs from L: =over =item C<< warning { BLOCK } >> =item C<< warnings { BLOCK } >> =back In addition, Test::Modern always enables the C test at the end of the file, ensuring that your test script generated no warnings other than the expected ones which were caught by C blocks. (See also C in L.) Test::Modern can also export an additional function for testing warnings, but does not export it by default: =over =item C<< shouldnt_warn { BLOCK } >> Runs a block of code that will hopefully not warn, but might. Tests that it doesn't warn, but performs that test as a "todo" test, so if it fails, your test suite can still pass. =back =head2 Features from Test::API Test::Modern exports the following subs from L: =over =item C<< public_ok($package, @functions) >> =item C<< import_ok($package, export => \@functions, export_ok => \@functions) >> =item C<< class_api_ok($class, @methods) >> =back =head2 Features from Test::LongString Test::Modern exports the following subs from L: =over =item C<< is_string($got, $expected, $description) >> =item C<< is_string_nows($got, $expected, $description) >> =item C<< like_string($got, $regexp, $description) >> =item C<< unlike_string($got, $regexp, $description) >> =item C<< contains_string($haystack, $needle, $description) >> =item C<< lacks_string($haystack, $needle, $description) >> =back Actually Test::Modern provides these via a wrapper. If Test::LongString is not installed then Test::Modern will provide a fallback implementation using Test::More's C, C, C, and C functions. (The diagnostics won't be as good in the case of failures.) =head2 Features from Test::Deep Test::Modern exports the following subs from L: =over =item C<< cmp_deeply($got, $expected, $description) >> =back The following are not exported by default, but can be exported upon request: =over =item C<< ignore() >> =item C<< methods(%hash) >> =item C<< listmethods(%hash) >> =item C<< shallow($thing) >> =item C<< noclass($thing) >> =item C<< useclass($thing) >> =item C<< re($regexp, $capture_data, $flags) >> =item C<< superhashof(\%hash) >> =item C<< subhashof(\%hash) >> =item C<< bag(@elements) >> =item C<< set(@elements) >> =item C<< superbagof(@elements) >> =item C<< subbagof(@elements) >> =item C<< supersetof(@elements) >> =item C<< subsetof(@elements) >> =item C<< all(@expecteds) >> =item C<< any(@expecteds) >> =item C<< obj_isa($class) >> =item C<< array_each($thing) >> =item C<< str($string) >> =item C<< num($number, $tolerance) >> =item C<< bool($value) >> =item C<< code(\&subref) >> =back As an alternative to using those functions, Test::Modern exports a constant C upon which you can call them as methods: # like Test::Deep::bag(@elements) TD->bag(@elements) =head2 Features from Test::Pod and Test::Pod::Coverage B<< These features are currently considered experimental. They may be removed from a future version of Test::Modern. >> Test::Modern can export the following subs from L and L, though they are not exported by default: =over =item C<< pod_file_ok($file, $description) >> =item C<< all_pod_files_ok(@dirs) >> =item C<< pod_coverage_ok($module, $params, $description) >> =item C<< all_pod_coverage_ok($params, $description) >> =back In fact, Test::Modern wraps these tests in checks to see whether Test::Pod(::Coverage) is installed, and the state of the C, C, and C environment variables. If none of those environment variables is set to true, then the test is skipped altogether. If Test::Pod(::Coverage) is not installed, then the test is skipped, unless C is true, in which case I<< Test::Pod(::Coverage) must be installed >>. This is usually a pretty sensible behaviour. You want authors to be made aware of pod errors if possible. You want to make sure they are tested before doing a release. End users probably don't want a pod formatting error to prevent them from installing the software, unless they opt into it using C. Also, Test::Modern wraps the C<< all_* >> functions to run them in a subtest (because otherwise they can interfere with your test plans). =head2 Features from Test::Version B<< These features are currently considered experimental. They may be removed from a future version of Test::Modern. >> Test::Modern can export the following subs from L, though they are not exported by default: =over =item C<< version_ok($file, $description) >> =item C<< version_all_ok(@dirs) >> =back These are wrapped similarly to those described in the L. Test::Modern can also export another sub based on C: =over =item C<< version_all_same(@dirs) >> Acts like C but also checks that all modules have the same version number. =back =head2 Features inspired by Test::Moose Test::Modern does not use L, but does provide the following function inspired by it: =over =item C<< does_ok($object|$subclass, $class, $name) >> Like C, but calls C<< $obj->DOES >> instead of C<< $obj->isa >>. =back =head2 Features inspired by Test::CleanNamespaces Test::Modern does not use L, but does provide the following function inspired by it: =over =item C<< namespaces_clean(@namespaces) >> Tests that namespaces don't contain any imported functions. (i.e. you haven't forgotten to use L or L in a class). Unlike the version of this function supplied with L, if C<< @namespaces >> contains more than one namespace, these will be run in a subtest, so the whole thing will only count as one test. =back =head2 Features inspired by Test::Benchmark Test::Modern does not use L, but does provide the following feature inspired by it: =over =item C<< is_fastest($implementation, $times, \%implementations, $desc) >> use Test::Modern qw( is_fastest ); is_fastest("speedy", -1, { "speedy" => sub { ... }, "slowcoach" => sub { ... }, }); This ensures that the named coderef runs the fastest out of a hashref of alternatives. The C<< -1 >> parameter in the example is the number of times to run the coderefs (see L for more details, including how numbers less than zero are interpreted). =back B<< Caveat: >> on fast computers, a set of coderefs that you might expect to differ in speed might all run in a negligible period of time, and thus be rounded to zero, in which case your test case could randomly fail. Use this test with caution! B<< Caveat the second: >> these tests tend to be slow. Use sparingly. Because of the aforementioned caveats, it is a good idea to move your benchmarking tests into separate test scripts, keeping an imaginary wall between them and the bulk of your test suite (which tests correctness rather than speed). Test::Modern provides an import hint suitable for including at the top of these benchmarking tests to mark them as being primarily concerned with speed: use Test::Modern -benchmark; This will not only import the C function, but will also I<< skip the entire script >> unless one of the C or C environment variables is set. =head2 Features inspired by Test::Requires Test::Modern does not use L, but does provide the following feature inspired by it: =over =item C<< use Test::Modern -requires => \%requirements >> This will skip the entire test script if the requirements are not met. For example: use Test::Modern -requires => { 'perl' => '5.010', 'Moose' => '2.11', 'namespace::autoclean' => undef, }; =back =head2 Features inspired by Test::RequiresInternet Similarly you can skip the test script if an Internet connection is not available: use Test::Modern -internet; You can check for the ability to connect to particular hosts and ports: use Test::Modern -internet => [ 'www.example.com' => 'http', '8.8.8.8' => 53, ]; Test::Modern does not use L but I've stolen much of the latter's implementation. =head2 Features inspired by Test::Without::Module Test::Modern does not use L, but does provide the following feature inspired by it: =over =item C<< use Test::Modern -without => \@modules >> This will run the tests as if the module was not installed. Useful for testing things in the absence of optional dependencies. For example: use Test::Modern -without => [ "Class::XSAccessor" ]; It cannot suppress modules from being loaded if they are required by Test::Modern itself. To get a list of what modules Test::Modern requires, run the following command: perl -MTest::Modern -le'print for sort keys %INC' (Note that the actual implementation is mostly stolen from L which seems to behave better than L.) =back =head2 Features inspired by Test::DescribeMe These export tags allow you to classify tests as "author tests", "release tests", "extended tests", or "interactive tests". They will cause your test script to be skipped depending on various environment variables. =over =item C<< use Test::Modern -author >> =item C<< use Test::Modern -release >> =item C<< use Test::Modern -extended >> =item C<< use Test::Modern -interactive >> =back =head2 Features inspired by Test::Lib B<< These features are currently considered experimental. They may be removed from a future version of Test::Modern. >> Test::Modern tries to find a directory called C<< t/lib >> by traversing up the directory tree from the caller file. If found, this directory will be added to C<< @INC >>. L would croak if such a directory cannot be found. L carries on if it can't find it. If you want something more like the Test::Lib behaviour, use the C<< -lib >> import tag: use Test::Modern -lib; =head2 Brand Spanking New Features Test::Modern provides a shortcut which combines several features it has pilfered from other testing modules: =over =item C<< object_ok($object, $name, %tests) >> Runs a gamut of subtests on an object: object_ok( $object, $name, isa => \@classes, does => \@roles, can => \@methods, api => \@methods, clean => $boolean, more => sub { my $object = shift; ...; } ); C<< $object >> may be a blessed object, or an unblessed coderef which returns a blessed object. The C<< isa >> test runs C<< isa_ok >>; the C<< does >> test runs C<< does_ok >>, the C<< can >> test runs C<< can_ok >>, and the C<< api >> test runs C<< class_api_ok >>. C<< clean >> allows you to run C<< namespaces_clean >> on the object's class. C<< more >> introduces a coderef for running more tests. Within this sub you can use any of the standard Test::More, Test::LongString, etc tests. It is automatically run in a C<< try >> block (see L); throwing an exception will cause the test to fail, but not cause the script to end. Any of the test hash keys may be omitted, in which case that test will not be run. C<< $name >> may be omitted. If the test succeeds, it returns the object (which may be useful for further tests). Otherwise, returns C. Practical example: my $bob = object_ok( sub { Employee->new(name => 'Robert Jones') }, '$bob', isa => [qw( Employee Person Moo::Object )], does => [qw( Employable )], can => [qw( name employee_number tax_code )], clean => 1, more => sub { my $object = shift; is($object->name, "Robert Jones"); like($object->employee_number, qr/^[0-9]+$/); }, ); # make further use of $bob object_ok( sub { $bob->line_manager }, isa => [qw( Person )], ); =back =head1 EXPORT This module uses L to perform its exports. This allows exported subs to be renamed, etc. The following export tags are supported: =over =item C<< -more >> Exports the L, except deprecated ones. =item C<< -deprecated >> Exports the deprecated Test::More features. =item C<< -fatal >> Exports the L. =item C<< -warnings >> Exports the L. =item C<< -api >> Exports the L, including C. =item C<< -strings >> Exports the L. =item C<< -deep >> Exports L. =item C<< -deeper >> Exports I the L. =item C<< -moose >> Exports the L. =item C<< -clean >> Exports the L. =item C<< -pod >> Exports the L. =item C<< -versions >> Exports the L. =item C<< -default >> Exports the default features -- all of the above except C<< -deprecated >>, C<< -pod >>, C<< -versions >>, and C<< -deeper >>. Also exports C. =item C<< -all >> Exports all of the above features I C<< -deprecated >>, C<< -pod >>, C<< -versions >>, C<< -deeper >>, C, and C. =item C<< -author >>, C<< -extended >>, C<< -interactive >>, and C<< -release >> Classify the test script. =item C<< -benchmark >> The test script consists mostly of benchmarking. =item C<< -internet >> The test script requires Internet access. =item C<< -requires >>, C<< -without >> Specify modules required or hidden for these test cases. =item C<< -lib >> Makes the absence of a C<< t/lib >> directory fatal. See L. =item C<< -verbose >> Makes test output more verbose. (Currently only C takes notice of this.) =back C<< $TODO >> is currently I exported. =head1 ENVIRONMENT Test::Modern is affected by the following environment variables: =over =item C, C, C, C These variables affect the behaviour of Test::Modern's pod-checking and version-checking. See L and L. They also can trigger certain import tags to skip a test script. See L, and L =item C Automatically skips any tests which indicate that they require Internet access, without even checking to see if the Internet is accessible. See L. =item C Setting this to true allows you to disable L' end test. Normally the end test will cause a test script to fail if any unexpected warnings are encountered during its execution. New versions of Perl, and upgrades of dependencies can cause a previously good test suite to start emitting warnings. This environment variable can be used as a "quick fix" to get the test suite passing again. =back =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L, L. L, L, L, L, L, L, L, L, L, L, L, L, L, L, L, L. L is a similar idea, but provides a slightly different combination of features. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES 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. Foo.pm000664001750001750 63012414307040 15553 0ustar00taitai000000000000Test-Modern-0.013/t/lib/Localpackage Local::Foo; sub bar { 42 } 1; __END__ =pod =encoding utf-8 =head1 PURPOSE Support file for C<< t/15tlib.t >>. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Toby Inkster. 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