Test-File-Contents-0.21000755000767000024 012132071630 14373 5ustar00davidstaff000000000000Test-File-Contents-0.21/Build.PL000444000767000024 174012132071630 16026 0ustar00davidstaff000000000000use strict; use warnings; use Module::Build; Module::Build->new( module_name => 'Test::File::Contents', license => 'perl', configure_requires => { 'Module::Build' => '0.30' }, build_requires => { 'Module::Build' => '0.30', 'Test::More' => '0.70', }, requires => { 'Test::Builder' => '0.70', 'Digest::MD5' => 0, 'File::Spec' => 0, 'perl' => 5.008003, 'Text::Diff' => '0.35', }, recommends => { 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.06', }, meta_merge => { resources => { homepage => 'http://search.cpan.org/dist/Test-File-Contents/', bugtracker => 'http://github.com/theory/test-file-contents/issues/', repository => 'http://github.com/theory/test-file-contents/tree/', } }, add_to_cleanup => [ 'Test-File-Contents-*' ], )->create_build_script; Test-File-Contents-0.21/Changes000444000767000024 417212132071630 16027 0ustar00davidstaff000000000000Revision history for Test-File-Contents 0.21 2013-04-12 - Require Test::Pod 1.41 for Pod tests. Fixes test failures due to the use of the `L` Pod syntax diallowed in earlier versions of Test::Pod. - Eliminated "v-string in use/require non-portable" warning on Perl 5.10.0. 0.20 2011-02-18 - Now require Perl 5.8.3 or higher. 5.8 has effectively been the required Perl all along thanks to the dependency on Digest::MD5. - Added encoding option, to make sure that files are read in their proper encoding. - Significant refactoring; only visible change should be that the actualy MD5 checksum will no longer be included in the `file_md5sum` failure diagnostics. - Renamed `file_md5sum` to `file_md5sum_is`. The old name remains as an alias for backwards compatibility. - Renamed `file_contents_identical` to `files_eq`. The old name remains as an alias for backwards compatibility. - Added `file_contents_eq_or_diff()` and `files_eq_or_diff()`. 0.10 2011-02-18 - Maintainership taken by David E. Wheeler. - Removed `examples/simple.pl`, since it wouldn't run anyway. - Added prototypes to the test functions. - Failure diagnostics now appear after the failure message, rather than before. - Renamed `file_contents_is` and `file_contents_isnt` to `file_contents_eq` and `file_contents_ne`, respectively. The old names remain as aliases for backwards compatibility. - Reworked default test descriptions to include the names of the files being tested. - Wordsmithed some of the diagnostic messages. 0.05 2007-03-20 - Packaging fixes. No functional changes. 0.04 2005-10-26 - Small tweaks to the packaging, mostly for CPANTS. No functional changes. 0.03 2006-01-20 - Added file_contents_isnt and file_contents_unlike and made file access OS-neutral (contributed by David Wheeler). 0.02 2004-08-25 - Minor packaging fixes. 0.01 2004-08-25 - First version, released on an unsuspecting world. Test-File-Contents-0.21/MANIFEST000444000767000024 33412132071630 15641 0ustar00davidstaff000000000000Build.PL Changes lib/Test/File/Contents.pm MANIFEST This list of files META.json META.yml README.md t/10.basic.t t/data/aaa.txt t/data/aaa2.txt t/data/bbb.txt t/data/utf8-2.txt t/data/utf8.txt t/pod-coverage.t t/pod.t Test-File-Contents-0.21/META.json000444000767000024 305612132071630 16155 0ustar00davidstaff000000000000{ "abstract" : "Test routines for examining the contents of files", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-File-Contents", "prereqs" : { "build" : { "requires" : { "Module::Build" : "0.30", "Test::More" : "0.70" } }, "configure" : { "requires" : { "Module::Build" : "0.30" } }, "runtime" : { "recommends" : { "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.06" }, "requires" : { "Digest::MD5" : "0", "File::Spec" : "0", "Test::Builder" : "0.70", "Text::Diff" : "0.35", "perl" : "5.008003" } } }, "provides" : { "Test::File::Contents" : { "file" : "lib/Test/File/Contents.pm", "version" : "0.21" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://github.com/theory/test-file-contents/issues/" }, "homepage" : "http://search.cpan.org/dist/Test-File-Contents/", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/theory/test-file-contents/tree/" } }, "version" : "0.21" } Test-File-Contents-0.21/META.yml000444000767000024 162712132071630 16007 0ustar00davidstaff000000000000--- abstract: 'Test routines for examining the contents of files' author: - unknown build_requires: Module::Build: 0.30 Test::More: 0.70 configure_requires: Module::Build: 0.30 dynamic_config: 1 generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-File-Contents provides: Test::File::Contents: file: lib/Test/File/Contents.pm version: 0.21 recommends: Test::Pod: 1.41 Test::Pod::Coverage: 1.06 requires: Digest::MD5: 0 File::Spec: 0 Test::Builder: 0.70 Text::Diff: 0.35 perl: 5.008003 resources: bugtracker: http://github.com/theory/test-file-contents/issues/ homepage: http://search.cpan.org/dist/Test-File-Contents/ license: http://dev.perl.org/licenses/ repository: http://github.com/theory/test-file-contents/tree/ version: 0.21 Test-File-Contents-0.21/README.md000444000767000024 215012132071630 16005 0ustar00davidstaff000000000000Test/File/Contents 0.21 ======================= This library's module, Test::File::Contents, provides an interface for testing file contents. Usage is quite simple: file_contents_eq $file, $contents, $description; file_contents_eq_or_diff $file, $string, $description; file_contents_like $file, qr/contents/, $description; file_md5_sum_is $file, $md5hash, $description; INSTALLATION To install this module, type the following: perl Build.PL ./Build ./Build test ./Build install Or, if you don't have Module::Build installed, type the following: perl Makefile.PL make make test make install Dependencies ------------ Test::File::Contents requires the following modules: * Perl 5.8.3 * Test::Builder * Digset::MD5 * File::Spec * Text::Diff Copyright and Licence --------------------- Copyright (c) 2004-2007 Kirrily Robert. Some Rights Reserved. Copyright (c) 2007-2011 David E. Wheeler. Some Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Test-File-Contents-0.21/lib000755000767000024 012132071630 15141 5ustar00davidstaff000000000000Test-File-Contents-0.21/lib/Test000755000767000024 012132071630 16060 5ustar00davidstaff000000000000Test-File-Contents-0.21/lib/Test/File000755000767000024 012132071630 16737 5ustar00davidstaff000000000000Test-File-Contents-0.21/lib/Test/File/Contents.pm000444000767000024 3007412132071630 21253 0ustar00davidstaff000000000000package Test::File::Contents; use 5.008003; use warnings; use strict; =encoding utf8 =head1 Name Test::File::Contents - Test routines for examining the contents of files =cut our $VERSION = '0.21'; use Test::Builder; use Digest::MD5; use File::Spec; use Text::Diff; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( file_contents_eq file_contents_eq_or_diff file_contents_ne file_contents_like file_contents_unlike file_md5sum_is files_eq files_eq_or_diff file_contents_is file_contents_isnt file_md5sum file_contents_identical ); my $Test = Test::Builder->new; =head1 Synopsis use Test::File::Contents; file_contents_eq $file, $string, $description; file_contents_eq_or_diff $file, $string, $description; file_contents_like $file, qr/foo/, $description; file_md5sum_is $file, $md5sum, $description; files_eq $file1, $file2, $description; files_eq_or_diff $file1, $file2, $description; =head1 Description Got an app that generates files? Then you need to test those files to make sure that their contents are correct. This module makes that easy. Use its test functions to make sure that the contents of files are exactly what you expect them to be. =head1 Interface =head2 Options These test functions take an optional hash reference of options which may include one or more of these options: =over =item C The encoding in which the file is encoded. This will be used in an I/O layer to read in the file, so that it can be properly decoded to Perl's internal representation. Examples include C, C, and C. See L for a list of supported encodings. May also be specified as a layer, such as ":utf8" or ":raw". See L for a complete list of layers. Note that it's important to specify the encoding if you have non-ASCII characters in your file. And the value to be compared against (the string argument to C and the regular expression argument to C, for example, must be decoded to Perl's internal form. The simplest way to do so use to put use utf8; In your test file and write it all in C. For example: use utf8; use Test::More tests => 1; use Test::File::Contents; file_contents_eq('utf8.txt', 'ååå', { encoding => 'UTF-8' }); file_contents_eq('latin1.txt', 'ååå', { encoding => 'UTF-8' }); =item C