Test::Approvals::Reporters::Win32Reporter - Generic base for creating reporters that work on Windows.
This documentation refers to Test::Approvals::Reporters::Win32Reporter version v0.0.5
package Test::Approvals::Reporters::MyCoolReporter; use strict; use warnings FATAL => 'all'; { use version; our $VERSION = qv('v0.0.5'); use Moose; with 'Test::Approvals::Reporters::Win32Reporter'; with 'Test::Approvals::Reporters::Reporter'; with 'Test::Approvals::Reporters::EnvironmentAwareReporter'; sub exe { return locate_exe( 'CoolCo', 'CooDiff.exe' ); } sub argv { return default_argv(); } } __PACKAGE__->meta->make_immutable; 1;
This module provides a common base for reporters on Windows. By extending this class, you get a search strategy for locating your reporter, and you don't have to worry about the details of launching a detatched child process.
my $argv = $reporter->default_argv();
Retrieve the shell arguments commonly used by diff utilities.
my $received = 'test.received.txt'; my $approved = 'test.approved.txt'; $reporter->launch($received, $approved);
Create a detached Windows process for the diff utility, passing the new process the arguments required to compare the approved file with the received file.
# Path within "Program Files" my $relative_path = 'DiffUtilMaker/SuperDiff'; # Diff utility executable name my $exe = 'SuperDiffUtil.exe'; my $exe_path = locate_exe($relative_path, $exe);
Search for $exe on the path, and in common locations. If not found, hope that it's underneath the Windows "Program Files" directory.
my $received = 'test.received.txt'; my $approved = 'test.approved.txt'; $reporter->report($received, $approved);
Normalize the paths to received and approved files, then try to launch the diff utility.
None at this time.
None.
Capture::Tiny File::Touch FindBin::Real Moose::Role version Win32::Process
None known.
Windows-only. Linux/OSX/other support will be added when time and access to those platforms permit.
Jim Counts - @jamesrcounts
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.
To install Test::Approvals, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Approvals
CPAN shell
perl -MCPAN -e shell install Test::Approvals
For more information on module installation, please visit the detailed CPAN module installation guide.