NAME
Test::Approvals::Core::FileApprover - Verify two files are the same
VERSION
This documentation refers to Test::Approvals::Core::FileApprover version v0.0.4
SYNOPSIS
use Test::Approvals::Core::FileApprover qw(verify);
use Test::Approvals::Namers::DefaultNamer;
use Test::Approvals::Writers::TextWriter;
use Test::Approvals::Reporters;
my $w = Test::Approvals::Writers::TextWriter->new( result => 'Hello' );
my $r = Test::Approvals::Reporters::DiffReporter->new();
my $n = Test::Approvals::Namers::DefaultNamer->new( name => 'Hello Test' );
ok verify( $w, $n, $r ), $n->name;
DESCRIPTION
This module provides the low level routines that actually compare two files for equality, and take the appropriate actions when the files don't match (ie. launch the reporter) and when the files do match (ie. clean up the received file).
SUBROUTINES/METHODS
verify
ok verify( $writer, $namer, $rerporter ), $namer->name;
Low level method to verify that the result data matches the approved data (stored in a file). Returns a value indicating whether the data matches and invokes the reporter when needed.
verify_files
my $failure = verify_files('r.txt', 'a.txt');
if(defined $failure) {
print "Verification failed because: $failure";
}
else {
pring "Verification success!";
}
Compare two files and return a message if they are not the same. When they are the same, return null.
DIAGNOSTICS
None at this time.
CONFIGURATION AND ENVIRONMENT
None.
DEPENDENCIES
Exporter
File::Compare
Readonly
Test::Builder
version
INCOMPATIBILITIES
None known.
BUGS AND LIMITATIONS
Windows-only. Linux/OSX/other support will be added when time and access to those platforms permit.
AUTHOR
Jim Counts - @jamesrcounts
LICENSE AND COPYRIGHT
Copyright (C) 2013 Jim Counts
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
L<http://www.apache.org/licenses/LICENSE-2.0>
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.