Scroll to navigation

App::CELL::Test(3pm) User Contributed Perl Documentation App::CELL::Test(3pm)

NAME

App::CELL::Test - functions for unit testing

SYNOPSIS

    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' ]
    );

DESCRIPTION

The "App::CELL::Test" module provides a number of special-purpose functions for use in CELL's test suite.

EXPORTS

This module exports the following routines:
cleartmpdir
cmp_arrays
mktmpdir
populate_file
touch_files

PACKAGE VARIABLES

FUNCTIONS

mktmpdir

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.

cleartmpdir

DESTROYs the temporary directory object (see File::Temp).

_touch

Touch a file

touch_files

"Touch" some files. Takes: directory path and list of files to "touch" in that directory. Returns number of files successfully touched.

populate_file

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.

cmp_arrays

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).

2022-06-28 perl v5.40.0