Test::...ggable(3pm)

πŸ“¦
version 1.30 Β· 5 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay so bestie, this is Test::Bot::BasicBot::Pluggable β€” it's a whole lil toolkit of utilities that help you test Bot::BasicBot::Pluggable modules. that's the vibe. that's the assignment. πŸŽ€

(and yeah, it lives in the perl manual pages β€” User Contributed Perl Documentation β€” we'll get to the receipts at the bottom, hold on πŸ’…)


✨ VERSION ✨

version 1.30 β€” she's grown, she's evolved, she's iconic πŸ‘‘


🌸 SYNOPSIS 🌸

here's the whole thing in action, no notes, just pure perfection:

use Test::More;
use Test::Bot::BasicBot::Pluggable;

my $bot = Test::Bot::BasicBot->new();
$bot->load('MyModule');

is ( $bot->tell_direct('foo'),   'bar');
is ( $bot->tell_indirect('foo'), 'bar');
is ( $bot->tell_private('foo'),  'bar');

like?? look at her go. three lil tells, three lil checks, chef's kiss 🀌


πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole reason Test::Bot::BasicBot::Pluggable exists is to give you a minimalistic testing bot β€” like a lil baby bot whose entire job is making your unit tests for Bot::BasicBot::Pluggable modules cleaner. that's it. that's her purpose. and she eats. πŸ’–


πŸ’… SUBROUTINES/METHODS πŸ’…

πŸŽ€ new

makes you a brand new Test::Bot::BasicBot::Pluggable object. and like, what even is that? it's basically just a subclass of Bot::BasicBot::Pluggable but with a few special methods sprinkled on top, iykyk.

the details, bestie:

  • default nickname is 'test_bot' 🩷
  • she comes with an in-memory store instead of sqlite (no disk drama, we love that)
  • takes the same arguments as Bot::BasicBot::Pluggable β€” so whatever you'd pass there, pass it here fr fr

⭐ INSTANCE METHODS ⭐

πŸ’¬ tell_direct

feeds your string to the bot as if it was sent directly to the bot in a public channel. the channel is called '#test' and the sending user is 'test_user'.

it looks a lil like this:

test_user@#test> test_bot: foo

periodt πŸ’…

🌈 tell_indirect

feeds your string to the bot as if it was sent to a public channel without addressing</a> her. same setup: channel is '#test', sending user is 'test_user'.

test_user@#test> foo

(no test_bot: prefix, she's just lurking in the channel eavesdropping, iconic behavior πŸ™ˆ)

πŸ“ tell_private

feeds your string to the bot like it was sent in a private channel. sending user is 'test_user'.

test_user@test_bot> foo

just the two of them. a private lil moment. 🫢

🧚 tell

this one right here? this is the working horse of Test::Bot::BasicBot::Pluggable. she's doing the heavy lifting. basically she builds a message hash to use as an argument for the bot's said() function.

⚠️ but bestie β€” you should never have to call it directly. leave her alone, she's working. 😀

πŸ”₯ connect

dispatches the connected event to all loaded modules without actually connecting to anything. fake it till you make it energy, and honestly? relatable. ✨

πŸ’€ DESTROY

this special subroutine is explicitly overridden with an empty subroutine β€” and the reason matters, so listen up: if she didn't do that, AUTOLOAD in Bot::BasicBot would get called for it. so. yeah. empty sub. protecting the peace. πŸ›‘οΈ


😭 BUGS AND LIMITATIONS 😭

there are no methods to test join, part and emote.

that's it. that's the limitation. we grieve together. πŸ’”


πŸ‘‘ AUTHOR πŸ‘‘

Mario Domgoergen <mdom@cpan.org>


Copyright 2009 Mario Domgoergen, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, bestie!! this was perl v5.40.0, dated 2024-08-24, brought to you by User Contributed Perl Documentation. mwah. go write some slay unit tests. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from