Test::Fixme(3pm)

πŸ“¦
version 0.17 Β· 7 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Test::Fixme πŸ’–

okay bestie, so this is Test::Fixme β€” the Perl module (it lives in the User Contributed Perl Documentation section of your man pages, iykyk) that checks your code for FIXMEs. yes. that's the whole vibe. it makes sure you don't just write "lol fix this later" and then literally never fix it. πŸ’…


✨ VERSION ✨

version 0.17 πŸŽ€


🌸 SYNOPSIS 🌸

drop this in a test script, like t/test-fixme.t:

# In a test script like 't/test-fixme.t'
use Test::Fixme;
run_tests();

# You can also tailor the behaviour.
use Test::Fixme;
run_tests( where    => 'lib',      # where to find files to check
           match    => 'TODO',     # what to check for
           skip_all => $ENV{SKIP}  # should all tests be skipped
);

see how we can customize it? main character energy fr. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so when you're coding, it's so common to hit a problem that lowkey needs addressing but is not, like, a big deal right this second. and what happens? the coder just leaves a lil comment like:

# FIXME - what about windows that are bigger than the screen?

# FIXME - add checking of user privileges here.

and then everyone forgets. forever. πŸ™ˆ

Test::Fixme lets you add a test file that ensures that none of these get forgotten in the module. it's giving accountability. it's giving ✨actually finishing things✨.


🌈 METHODS 🌈

run_tests

by default, run_tests will search for 'FIXME' in all the files it can find in the project. you can change these defaults by using 'where' or 'match' like this:

run_tests( where => 'lib', # just check the modules.
           match => 'TODO' # look for things that are not done yet.
);

where

specifies where to search for files. this can be a scalar containing a single directory name, or it can be a list reference containing multiple directory names. (yes, plural. we stan options.)

match

expression to search for within the files. this may be a simple string, or a qr//-quoted regular expression. for example:

match => qr/[T]ODO|[F]IXME|[B]UG/,

filename_match

expression to filter file names. this should be a qr//-quoted regular expression. for example:

match => qr/\.(:pm|pl)$/,

would only match .pm and .pl files under your specified directory. periodt. 🎯

manifest

specifies the name of your MANIFEST file which will be used as the list of files to test instead of where or filename_match. like so:

manifest => 'MANIFEST',

warn

do not fail when a FIXME or other pattern is matched. tests that would have been failures will still issue a diagnostic that will be viewed when you run "prove" without "-v", "make test" or "./Build test". so like, it's still snitching, just quieter. πŸ’€

format

specifies format to be used for display of pattern matches.

original

the original and currently default format looks something like this:

# File: './lib/Test/Fixme.pm'
#     16      # ABSTRACT: Check code for FIXMEs.
#     25          $args{match} = 'FIXME' unless defined $args{match} && length $args{match};
#     28          $args{format} ||= $ENV{TEST_FIXME_FORMAT};
#     228      # FIXME - what about windows that are bigger than the screen?
#     230      # FIXME - add checking of user privileges here.
#     239     By default run_tests will search for 'FIXME' in all the files it can
#     280     Do not fail when a FIXME or other pattern is matched.  Tests that would
#     288     If you want to match something other than 'FIXME' then you may find
#     296      run_tests( skip_all => $ENV{SKIP_TEST_FIXME} );
#     303     L<Devel::FIXME>

with the line numbers on the left and the offending text on the right. cute and readable, we love her. πŸ’–

perl

the "perl" format is that used by Perl itself to report warnings and errors.

# Pattern found at ./lib/Test/Fixme.pm line 16:
#  # ABSTRACT: Check code for FIXMEs.
# Pattern found at ./lib/Test/Fixme.pm line 25:
#      $args{match} = 'FIXME' unless defined $args{match} && length $args{match};
# Pattern found at ./lib/Test/Fixme.pm line 28:
#      $args{format} ||= $ENV{TEST_FIXME_FORMAT};
# Pattern found at ./lib/Test/Fixme.pm line 228:
#   # FIXME - what about windows that are bigger than the screen?
# Pattern found at ./lib/Test/Fixme.pm line 230:
#   # FIXME - add checking of user privileges here.
# Pattern found at ./lib/Test/Fixme.pm line 239:
#  By default run_tests will search for 'FIXME' in all the files it can
# Pattern found at ./lib/Test/Fixme.pm line 280:
#  Do not fail when a FIXME or other pattern is matched.  Tests that would
# Pattern found at ./lib/Test/Fixme.pm line 288:
#  If you want to match something other than 'FIXME' then you may find
# Pattern found at ./lib/Test/Fixme.pm line 296:
#   run_tests( skip_all => $ENV{SKIP_TEST_FIXME} );
# Pattern found at ./lib/Test/Fixme.pm line 303:
#  L<Devel::FIXME>

for files that contain many offending patterns it may be a bit harder to read for humans, but easier to parse for IDEs. so like, robots love it, your eyes might not. πŸ€–

you may also use the "TEST_FIXME_FORMAT" environment variable to override either the default or the value specified in the test file. slay, configurable. ⭐


πŸ’œ HINTS πŸ’œ

if you want to match something other than 'FIXME' then you may find that the test file itself is being caught. try doing this:

run_tests( match => 'TO'.'DO' );

you may also wish to suppress the tests β€” try this:

use Test::Fixme;
run_tests( skip_all => $ENV{SKIP_TEST_FIXME} );
🫢 heads up bestie: you can only run run_tests once per file. please use several test files if you want to run several different tests. one and done, no cap.

πŸ’€ CAVEATS πŸ’€

this module is fully supported back to Perl 5.8.1. it may work on 5.8.0. it should work on Perl 5.6.x and the author may even test on 5.6.2. patches to maintain compatibility for such older Perls will be accepted, but you may need to fix it on 5.6.x / 5.8.0 and send in a patch. ancient Perl? it's giving archaeology, but respectful. 🏺


πŸ”₯ SEE ALSO πŸ”₯

  • Devel::FIXME

πŸŽ€ ACKNOWLEDGMENTS πŸŽ€

Dave O'Neill added support for 'filename_match' and also being able to pass a list of several directories in the 'where' argument. many thanks. πŸ™ literally iconic of him.


πŸ‘‘ AUTHOR πŸ‘‘

original author: Edmund von der Burg

current maintainer: Graham Ollis <plicease@cpan.org>

contributors:

  • Dave O'Neill
  • gregor herrmann <gregoa@debian.org>

this software is copyright (c) 2005-2024 by Edmund von der Burg <evdb@ecclestoad.co.uk>, Graham Ollis <plicease@cpan.org>.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. fr fr, free as in freedom. πŸ•ŠοΈ


and that's the whole page, bestie!! this was Test::Fixme version 0.17, shipped as part of perl v5.40.1 on 2025-03-01 β€” go forth and fix your FIXMEs, or at least make a test yell about them. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from