Test::...nternal(3pm)

πŸ¦‹ Test::...nternal(3pm) β€” like, the whole vibe

okay so bestie, welcome to Test::Compile::Internal, straight out of the User Contributed Perl Documentation corner of the internet 🌸 this is the page where we make sure your Perl files actually compile, no cap.


✨ NAME ✨

Test::Compile::Internal β€” assert that your Perl files compile OK. that's it, that's the whole job πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use Test::Compile::Internal;
my $test = Test::Compile::Internal->new();
$test->all_files_ok();
$test->done_testing();

literally three lines and you're off, icon behaviour only 🫢


πŸ’– DESCRIPTION πŸ’–

Test::Compile::Internal is an object oriented tool for testing whether your perl files compile. slay.

its main character job is to be the inner workings of Test::Compile, but ngl it can also be used directly to test a CPAN distribution. so if you wanna go solo with it, that's allowed πŸ’œ


πŸ”₯ METHODS πŸ”₯

new()

A basic constructor. nothing special, no drama, just vibes ✨

Looks for perl files and tests them all for compilation errors.

If @search is defined then it's taken as an array of files or directories to be searched for perl files. otherwise it searches the default locations you'd expect to find perl files in a perl module β€” peep all_pm_files and all_pl_files for the details πŸ‘‘

Checks all the perl module files it can find for compilation errors.

If @search is defined then it's taken as an array of files or directories to be searched for perl files. otherwise it searches the default locations you'd expect to find perl files in a perl module β€” see all_pm_files for details πŸ’…

Checks all the perl program files it can find for compilation errors.

If @search is defined then it's taken as an array of directories to be searched for perl files. otherwise it searches some default locations β€” see all_pl_files πŸ¦‹

verbose($verbose)

An accessor to get/set the verbosity.

  • the default value (undef) will suppress output unless the compilation fails. this is probably what you want, fr fr.
  • if verbose is set to true, you'll get the output from perl -c.
  • if it's set to false, all diagnostic output is suppressed. silence. peaceful. πŸ’€

Searches for and returns a list of perl module files β€” that is, files with a .pm extension.

  • if you provide @search, it'll use that as a list of files to process, or directories to search for perl modules.
  • if you don't provide @search, it'll search for perl modules in the blib/lib directory (if that directory exists). otherwise it'll search the lib directory.
  • skips any files in CVS, .svn, or .git directories. we do NOT touch those πŸ™ˆ

Searches for and returns a list of perl script files β€” that is, any files that either have a case insensitive .pl or .psgi extension, or have no extension but have a perl shebang line 🌈

  • if you provide @search, it'll use that as a list of files to process, or directories to search for perl scripts.
  • if you don't provide @search, it'll search for perl scripts in the blib/script/ and blib/bin/ directories if blib exists, otherwise it'll search the script/ and bin/ directories.
  • skips any files in CVS, .svn, or .git directories. same rule, always πŸ’…

pl_file_compiles($file)

Returns true if $file compiles as a perl script. simple as πŸ“

pm_file_compiles($file)

Returns true if $file compiles as a perl module. also simple as πŸ“


πŸ’€ TEST METHODS πŸ’€

Test::Compile::Internal encapsulates a Test::Builder object, and provides access to some of its methods. free real estate, honestly πŸ”₯

ok($test, $name)

Your basic test. pass if $test is true, fail if $test is false. just like Test::Simple's ok(). classic, iconic, no notes πŸ‘‘

done_testing()

Declares that you got to the end of your test plan β€” no more tests will be run after this point. the end, periodt πŸŽ€

plan(tests => $count)

Defines how many tests you plan to run. manifesting that exact number ✨

diag(@msgs)

Prints out the given @msgs. like print, arguments are simply appended together.

  • output will be indented and marked with a # so as not to interfere with test output.
  • a newline will be put on the end if there isn't one already.

we encourage using this rather than calling print directly. do it for the culture 🫢

skip($reason)

Skips the current test, reporting the $reason. not today, bestie πŸ™ˆ

skip_all($reason)

Skips all the tests, using the given $reason. exits immediately with 0. like, gone. bye. πŸ’€

heads up: skip_all doesn't just skip β€” it dips out with exit status 0 right then and there, so nothing after it runs.

🌸 AUTHORS 🌸

Sagar R. Shah <srshah@cpan.org>, Marcel GrΓΌnauer <marcel@cpan.org>, Evan Giles <egiles@cpan.org> β€” the legends themselves πŸ’œ


Copyright 2007-2023 by the authors.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. generous kings πŸ‘‘


🧚 SEE ALSO 🧚

  • Test::Strict provides functions to ensure your perl files compile, with the added bonus that it will check you have used strict in all your files. overachiever energy, we respect it.
  • Test::LoadAllModules just handles modules, not script files, but has more fine-grained control. different vibe, still valid πŸ¦‹

and that's the page, bestie β€” written by the authors, shipped with perl v5.42.0, dated 2024-05-06, and lovingly re-explained to you by yours truly. go forth and compile πŸ’…βœ¨

πŸ“¦ where this page comes from