Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Evalable ignore ‘???’ and ‘sleep &’
These just happen to be common and somewhat valid.
  • Loading branch information
AlexDaniel committed Aug 22, 2019
1 parent c1e3457 commit a32bb60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xbin/Evalable.p6
Expand Up @@ -47,6 +47,8 @@ multi method irc-privmsg-channel($msg) {
my $nonword-ratio = $msg.args[1].comb(/<-alpha -space>/) ÷ $msg.args[1].chars;
nextsame if $nonword-ratio < 0.1; # skip if doesn't look like code at all
nextsame if $msg.args[1] ~~ /^ \s*<[\w-]>+‘:’ /; # skip messages to other bots
nextsame if $msg.args[1] eq ???; # unfortunate trigger (???)
nextsame if $msg.args[1] ~~ /^ \w+ \s+ ‘&’ \s* $/; # unfortunate trigger (sleep &)

self.process: $msg, $msg.args[1], :good-only
}
Expand Down
6 changes: 6 additions & 0 deletions xt/evalable.t
Expand Up @@ -228,6 +228,12 @@ $t.test(‘segfaults are not ignored’,
use NativeCall; sub strdup(int64) is native(Str) {*}; strdup(0),
/^ <me($t)>‘, rakudo-moar ’<sha>‘: OUTPUT: «(signal SIGSEGV) »’ $/);

$t.test(ignore common messages (sleep &),
sleep &);

$t.test(ignore common messages (???),
???);

# Timeouts

$t.test(timeout,
Expand Down

0 comments on commit a32bb60

Please sign in to comment.