|App::CELL::Test(3pm)||User Contributed Perl Documentation||App::CELL::Test(3pm)|
App::CELL::Test - functions for unit testing
use App::CELL::Test; App::CELL::Test::cleartmpdir(); my $tmpdir = App::CELL::Test::mktmpdir(); App::CELL::Test::touch_files( $tmpdir, 'foo', 'bar', 'baz' ); my $booltrue = App::CELL::Test::cmp_arrays( [ 0, 1, 2 ], [ 0, 1, 2 ] ); my $boolfalse = App::CELL::Test::cmp_arrays( [ 0, 1, 2 ], [ 'foo', 'bar', 'baz' ] );
The "App::CELL::Test" module provides a number of special-purpose functions for use in CELL's test suite.
This module exports the following routines:
Creates the App::CELL testing directory in a temporary directory (obtained using File::Temp) and returns the path to this directory in the payload of a status object.
DESTROYs the temporary directory object (see File::Temp).
Touch a file
"Touch" some files. Takes: directory path and list of files to "touch" in that directory. Returns number of files successfully touched.
Takes filename (full path) and contents (as a string, potentially containing newlines) to write to it. If the file exists, it is first unlinked. Then the routine creates the file and populates it with the contents. Returns true if something was written, or false if not.
Compare two arrays of unique elements, order doesn't matter. Takes: two array references Returns: true (they have the same elements) or false (they differ).