App::CELL::Test(3pm)

πŸ“¦
version 0.231 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute

πŸ’– App::CELL::Test β€” the vibe check on unit testing πŸ’–

okay so bestie, this is App::CELL::Test, a Perl module living in the User Contributed Perl Documentation section of the manual (that's the (3pm) bit, iykyk). It's the lil backstage crew of the CELL project: a whole pile of special-purpose functions that only really show up when you're running CELL's test suite. She's not for production, she's for vibes and validation. ✨


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

like look at her go 🫢 she makes a tmpdir, touches some files, and compares arrays. no notes.


πŸ¦‹ DESCRIPTION πŸ¦‹

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

that's it. that's the whole job description. she's the test-suite bestie and she ate. πŸ’…


πŸŽ€ EXPORTS πŸŽ€

This module exports the following routines:

  • cleartmpdir
  • cmp_arrays
  • mktmpdir
  • populate_file
  • touch_files

πŸ‘‘ PACKAGE VARIABLES πŸ‘‘

(no cap, this section is literally empty in the original. iconic of her to leave a blank space and just move on. we respect it.)


πŸ”₯ FUNCTIONS πŸ”₯

πŸ’« mktmpdir

Creates the App::CELL testing directory in a temporary directory β€” and that temp dir is obtained using File::Temp, just so you know where it came from β€” and returns the path to this directory in the payload of a status object. πŸ—‚οΈ

πŸ’« cleartmpdir

DESTROYs the temporary directory object (see File::Temp). it's giving cleanup era. she is done with that directory. πŸ’€βœ¨

🧚 _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. πŸ“

bestie heads up: if that file already exists, it's getting unlinked first. no survivors, only fresh content. πŸ’…

πŸ’« 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). βš–οΈ


and that's the whole page, bestie! πŸŒˆπŸ’– this gorgeous thing lives in the manual as App::CELL::Test(3pm), it's part of the User Contributed Perl Documentation collection, and she was written for perl v5.34.0 back on 2022-07-17. mwah, go write some tests. πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from