Test-File-Contents-0.23000755000767000024 012672311443 14405 5ustar00davidstaff000000000000Test-File-Contents-0.23/Build.PL000444000767000024 173412672311443 16043 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 => 'https://github.com/theory/test-file-contents/issues/', repository => 'https://github.com/theory/test-file-contents', } }, add_to_cleanup => [ 'Test-File-Contents-*' ], )->create_build_script; Test-File-Contents-0.23/Changes000444000767000024 504512672311443 16041 0ustar00davidstaff000000000000Revision history for Test-File-Contents 0.23 2016-03-16T17:09:37Z - Fix encoding errors when reading in a file on Windows with `utf8` enabled. See https://rt.perl.org/Ticket/Display.html?id=127668 for the bug we've worked around. 0.22 2016-03-02T23:54:26Z - Adjusted tests to account for change in output of Text::Diff 1.44. They still pass with earlier versions of Text::Diff. - Removed Pod tests from the distribution. 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.23/MANIFEST000444000767000024 30012672311443 15644 0ustar00davidstaff000000000000Build.PL Changes lib/Test/File/Contents.pm MANIFEST This list of files README 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 META.yml META.json Test-File-Contents-0.23/META.json000444000767000024 300212672311443 16156 0ustar00davidstaff000000000000{ "abstract" : "Test routines for examining the contents of files", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4212", "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.23" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/theory/test-file-contents/issues/" }, "homepage" : "http://search.cpan.org/dist/Test-File-Contents/", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "https://github.com/theory/test-file-contents" } }, "version" : "0.23" } Test-File-Contents-0.23/META.yml000444000767000024 165512672311443 16022 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.4212, CPAN::Meta::Converter version 2.150001' 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.23' 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: https://github.com/theory/test-file-contents/issues/ homepage: http://search.cpan.org/dist/Test-File-Contents/ license: http://dev.perl.org/licenses/ repository: https://github.com/theory/test-file-contents version: '0.23' Test-File-Contents-0.23/README000444000767000024 215012672311443 15420 0ustar00davidstaff000000000000Test/File/Contents 0.23 ======================= 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-2016 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.23/lib000755000767000024 012672311443 15153 5ustar00davidstaff000000000000Test-File-Contents-0.23/lib/Test000755000767000024 012672311443 16072 5ustar00davidstaff000000000000Test-File-Contents-0.23/lib/Test/File000755000767000024 012672311443 16751 5ustar00davidstaff000000000000Test-File-Contents-0.23/lib/Test/File/Contents.pm000444000767000024 3030612672311443 21263 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.23'; 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