Test::...ggable(3pm)
π 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>
π LICENSE AND COPYRIGHT π
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
- ubuntu resolute: libbot-basicbot-pluggable-perl 1.30+ds1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbot-basicbot-pluggable-perl 1.30+ds1-1 Β· 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