1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 18:45:42 -04:00

Fill out more mock said object, the rest of the plugins need more complete support

This commit is contained in:
Ryan Voots 2020-10-30 18:16:40 -07:00
parent cef088bf52
commit 440c75037d
3 changed files with 50 additions and 0 deletions

23
t/arg-plugin.t Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Test::More;
use lib::relative './lib', '../lib', '..';
use t::simple_plugin;
use Encode qw/encode/;
load_plugin("arg");
check("n", "perlbot", [1], "empty but valid");
check("a", "a", [1], "macro args"); # this one is difficult to test for, it really gets the arguments to the parent macro
check("", "", [1], "empty arguments, needs better check");
check("h", "irc.client.example.com", [1], "host");
check("c", "##NULL", [1], "channel");
check("o", 0, [1], "is op?");
check("s", "irc.server.example.com", [1], "server");
done_testing();

16
t/echo-plugin.t Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use Test::More;
use lib::relative './lib', '../lib', '..';
use t::simple_plugin;
use Encode qw/encode/;
load_plugin("echo");
check("", "", [1], "empty but valid");
check("Hello World", "Hello World", [1], "HW");
check("\N{SNOWMAN}", encode("utf8", "\N{SNOWMAN}"), [1], "Encoding correctly");
done_testing();

View file

@ -25,10 +25,21 @@ sub make_said
# TODO make this fill out a lot more of the said object # TODO make this fill out a lot more of the said object
$who //= "perlbot";
my @args = split /\s+/, $body; my @args = split /\s+/, $body;
my $said = { my $said = {
body => $body, body => $body,
recommended_args => \@args, recommended_args => \@args,
macro_args => $body,
name => $who,
ircname => $who."irc",
host => "irc.client.example.com",
sender_raw => "", # this never gets filled out
channel => $channel // "##NULL",
server => $server // "irc.server.example.com",
by_chan_op => 0,
captured => "",
}; };
} }