Badger...Manager(3pm)
π Badger::Test::Manager β the tea β
okay bestie, gather round, because this is the manual page for Badger::Test::Manager (yes, it's Badger...Manager(3pm), the name got squished by the man page formatter, we don't talk about it π
), straight out of the User Contributed Perl Documentation. It's the test manager module and it is literally here to make your tests go brrr. π¦
β¨ NAME β¨
Badger::Test::Manager β it's the test manager module, no cap. π
πΈ SYNOPSIS πΈ
here's the whole vibe, copy-paste ready:
use Badger::Test::Manager;
# object methods
my $manager = Badger::Test::Manager->new( plan => 7 );
$manager->ok($bool, 'This is a test');
$manager->pass('This is ok');
$manager->fail('This is not ok');
$manager->is($this, $this, 'This and that are equal');
$manager->isnt($this, $this, 'This and that are not equal');
$manager->like($this, qr/that/, 'This is matched by that');
$manager->unlike($this, qr/that/, 'This is not matched by that');
# class methods
Badger::Test::Manager->plan(7);
Badger::Test::Manager->ok($bool, 'This is a test');
Badger::Test::Manager->pass('This is ok');
Badger::Test::Manager->fail('This is not ok');
# ... plus is(), isnt(), like() unlike() methods, as above
so you can either make an object and poke it, or call everything straight off the class like a boss π
π DESCRIPTION π
This module implements a simple test manager for Badger::Test. That's it, that's the whole thing, and honestly? iconic. β¨
π«Ά METHODS π«Ά
okay so the important thing first: all of these methods can be called as class methods or as object methods. π When you call them as class methods, they get called against a prototype object β the one handed back by the prototype() method that's inherited from Badger::Prototype. iykyk.
π plan($tests)
how many tests you plan to run. bestie, listen β an error will be thrown if you try to call this method twice. one shot, one opportunity. π
π§Ύ result($flag,@args)
low-level method to generate a test result. it's giving internals, you probably won't touch it directly. π§
β
ok($flag, $name)
report on the success or failure of a test:
$manager->ok(1, 'This is good');
$manager->ok(0, 'This is bad');
π° is($this, $that, $name)
test if the first two arguments are equal. slay.
$manager->is($this, $that, "This and that are equal");
π« isnt($this, $that, $name)
test if the first two arguments are not equal.
$manager->isnt($this, $that, "This and that are equal");
π like($text, qr/regex/, $name)
test if the first argument is matched by the regex passed as the second argument.
$manager->like($this, qr/like that/i, "This and that are alike");
π
unlike($text, qr/regex/, $name)
test if the first argument is not matched by the regex passed as the second argument.
$manager->unlike($this, qr/like that/i, "This and that are unalike");
π pass($name)
pass a test. we love to see it π
$manager->pass('Module Loaded');
π fail($name)
fail a test. it happens to the best of us.
$manager->fail('Stonehenge crushed by a dwarf');
βοΈ skip($reason)
skip a single test.
$manager->skip("We don't have that piece of scenery any more");
βοΈβοΈ skip_some($number,$reason)
skip a number of tests. plural. many skips. π
$manager->skip_some(11, "We don't have that piece of scenery any more");
π skip_rest(,$reason)
skip any remaining tests. (yes, the signature really does start with a bare comma, we don't ask questions π)
$manager->skip_rest("We don't have that piece of scenery any more");
π skip_all($reason)
skip all the tests. you should call this instead of plan() β not as well as, instead of. π«‘
$manager->skip_all("We don't have that piece of scenery any more");
π¨ colour($flag)
method to enable or disable colour mode. aesthetic on/off switch basically.
π¨ color($flag)
an alias for colour(). for the American spelling girlies. πΊπΈ
π INTERNAL METHODS π
π finish()
this method is called automatically when the "Badger::Test::Manager" object is destroyed. it flushes any pending tests, performs any final sanity checks, and prints a summary if requested. main character energy, does it all without being asked. π
π° flush()
this methods flushes any cached test results. you don't need to worry about it. fr fr, go live your life. π¦
π summary()
this method generates a final summary of the tests.
π¬ test_msg()
used to generate the test messages displayed via the Badger::Base messages() method. the message formats are defined in the $MESSAGES package variable.
π·οΈ test_name()
use to generate a name for a test if one isn't explicitly provided.
π§ different($expect,$result)
this method is call when a test find a result that doesn't match the expected value. (the original prose is a little chaotic there and honestly? same.)
if "Algorithm::Diff" is installed on your machine, it will generate a message showing how the output and expected values differ. π¬
otherwise it will generate a regular message reporting the mismatch.
π AUTHOR π
Andy Wardley <http://wardley.org/> β the legend themselves. π
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 1996-2009 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so go forth and remix, bestie. π
π SEE ALSO π
Badger::Test
and that's the whole page, bestie!! π this came to you from the User Contributed Perl Documentation corner of the internet, Badger...Manager(3pm), documented with perl v5.36.0 on 2023-08-28. go write some tests and make them all pass β no cap. π
β¨π¦
π¦ where this page comes from
- debian trixie: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms