Badger...Manager(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute

πŸ’– 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 (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