mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +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
|
# action=True implies noLengthCheck=True and prefixName=False
|
||||||
self.noLengthCheck=noLengthCheck or self.noLengthCheck or self.action
|
self.noLengthCheck=noLengthCheck or self.noLengthCheck or self.action
|
||||||
target = self.private and self.to or self.msg.args[0]
|
target = self.private and self.to or self.msg.args[0]
|
||||||
|
s = str(s) # Allow non-string esses.
|
||||||
if self.finalEvaled:
|
if self.finalEvaled:
|
||||||
try:
|
try:
|
||||||
if isinstance(self.irc, self.__class__):
|
if isinstance(self.irc, self.__class__):
|
||||||
|
@ -276,6 +276,20 @@ class AmbiguityTestCase(PluginTestCase):
|
|||||||
self.irc.addCallback(self.Bar(self.irc))
|
self.irc.addCallback(self.Bar(self.irc))
|
||||||
self.assertResponse('bar', 'bar.bar')
|
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):
|
class PrivmsgTestCase(ChannelPluginTestCase):
|
||||||
plugins = ('Utilities', 'Misc',)
|
plugins = ('Utilities', 'Misc',)
|
||||||
conf.allowEval = True
|
conf.allowEval = True
|
||||||
|
Loading…
Reference in New Issue
Block a user