mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Properly fixed bugs where plugins expected strings and got non-strings.
This commit is contained in:
parent
a1992b55ec
commit
4fb15198a0
@ -819,6 +819,7 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||
# action=True implies noLengthCheck=True and prefixName=False
|
||||
self.noLengthCheck=noLengthCheck or self.noLengthCheck or self.action
|
||||
target = self.private and self.to or self.msg.args[0]
|
||||
s = str(s) # Allow non-string esses.
|
||||
if self.finalEvaled:
|
||||
try:
|
||||
if isinstance(self.irc, self.__class__):
|
||||
|
@ -275,6 +275,20 @@ class AmbiguityTestCase(PluginTestCase):
|
||||
self.assertResponse('bar', 'foo.bar')
|
||||
self.irc.addCallback(self.Bar(self.irc))
|
||||
self.assertResponse('bar', 'bar.bar')
|
||||
|
||||
class ProperStringificationOfReplyArgs(PluginTestCase):
|
||||
plugins = ('Misc',) # Same as above.
|
||||
class NonString(callbacks.Plugin):
|
||||
def int(self, irc, msg, args):
|
||||
irc.reply(1)
|
||||
class ExpectsString(callbacks.Plugin):
|
||||
def lower(self, irc, msg, args):
|
||||
irc.reply(args[0].lower())
|
||||
|
||||
def test(self):
|
||||
self.irc.addCallback(self.NonString(self.irc))
|
||||
self.irc.addCallback(self.ExpectsString(self.irc))
|
||||
self.assertResponse('expectsstring lower [nonstring int]', '1')
|
||||
|
||||
class PrivmsgTestCase(ChannelPluginTestCase):
|
||||
plugins = ('Utilities', 'Misc',)
|
||||
|
Loading…
Reference in New Issue
Block a user