Test::Approvals::Namers::DefaultNamer - Default algorithm for generating names
This documentation refers to Test::Approvals::Namers::DefaultNamer version v0.0.4
# C:/usr/example.pl use Test::Approvals::Namers::DefaultNamer; my $n = Test::Approvals::Namers::DefaultNamer->new( directory => 'c:\tmp', name => 'foo' ); my $x = $n->get_approved_file('txt'); # C:\tmp\example.pl.foo.approved.txt my $y = $n->get_received_file('txt'); # C:\tmp\example.pl.foo.received.txt # Cleans the input when necessary my $o = Test::Approvals::Namers::DefaultNamer->new( directory => 'c:/tmp/', name => 'foo.' ); # Still C:\tmp\example.pl.foo.received.txt my $z = $o->get_received_file('.txt'); # Uses current script directory by default my $p = Test::Approvals::Namers::DefaultNamer->new( name => 'foo' ); # Now C:\usr\example.pl.foo.approved.txt my $a = $p->get_approved_file('txt');
The DefaultNamer class contains an algorithm for generating names for files to store test results in. It also provides easy access to the name of the test it is associated with.
my $n = Test::Approvals::Namers::DefaultNamer->new( directory => 'c:\tmp', name => 'foo' ); my $path = $n->get_approved_file('txt');
Generate the full path to the approved file. In the example above $path will be assigned: 'C:\tmp\<script>.foo.approved.txt', where <script> is the name of the caller's script (similar to the output of FindBin::Real::Script)
my $n = Test::Approvals::Namers::DefaultNamer->new( directory => 'c:\tmp', name => 'foo' ); my $path = $n->get_received_file('txt');
Generate the full path to the received file. In the example above $path will be assigned: 'C:\tmp\<script>.foo.received.txt', where <script> is the name of the caller's script (similar to the output of FindBin::Real::Script)
my $n = Test::Approvals::Namers::DefaultNamer->new( directory => 'c:\tmp', name => 'foo' ); my $path = $n->get_filename('txt', 'bar');
Generate the full path to the requested file of the requested type. In the example above $path will be assigned: 'C:\tmp\<script>.foo.bar.txt', where <script> is the name of the caller's script (similar to the output of FindBin::Real::Script)
None at this time.
None.
File::Spec FindBin::Real Moose version
None known.
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.