Properly fixed bugs where plugins expected strings and got non-strings.

This commit is contained in:
Jeremy Fincher 2005-05-23 11:51:22 +00:00
parent a1992b55ec
commit 4fb15198a0
2 changed files with 15 additions and 0 deletions

View File

@ -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__):

View File

@ -276,6 +276,20 @@ class AmbiguityTestCase(PluginTestCase):
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',)
conf.allowEval = True