mirror of https://github.com/Mikaela/Limnoria.git
Fix for bug #849619.
This commit is contained in:
parent
23968baf49
commit
d64f5314f8
|
@ -145,13 +145,17 @@ class Utilities(callbacks.Privmsg):
|
||||||
try:
|
try:
|
||||||
f = utils.perlReToReplacer(regexp)
|
f = utils.perlReToReplacer(regexp)
|
||||||
substitution = True
|
substitution = True
|
||||||
except ValueError:
|
except ValueError, e:
|
||||||
irc.error(msg, 'Invalid regexp: %s' % e.args[0])
|
irc.error(msg, 'Invalid regexp: %s' % e.args[0])
|
||||||
return
|
return
|
||||||
if f is None:
|
if f is None:
|
||||||
irc.error(msg, 'Invalid regexp: %s' % e.args[0])
|
irc.error(msg, 'Invalid regexp: %s' % e.args[0])
|
||||||
return
|
return
|
||||||
irc.reply(msg, f(text))
|
if f(''): # It matches the empty string.
|
||||||
|
s = 'You probably don\'t want to match the empty string.'
|
||||||
|
irc.error(msg, s)
|
||||||
|
else:
|
||||||
|
irc.reply(msg, f(text))
|
||||||
|
|
||||||
|
|
||||||
Class = Utilities
|
Class = Utilities
|
||||||
|
|
|
@ -73,6 +73,9 @@ class UtilitiesTestCase(PluginTestCase, PluginDocumentation):
|
||||||
self.assertNotRegexp('re m/foo/ bar', 'has no attribute')
|
self.assertNotRegexp('re m/foo/ bar', 'has no attribute')
|
||||||
self.assertResponse('re m/a\S+y/ "the bot angryman is hairy"','angry')
|
self.assertResponse('re m/a\S+y/ "the bot angryman is hairy"','angry')
|
||||||
|
|
||||||
|
def testReNotEmptyString(self):
|
||||||
|
self.assertError('re s//foo/g blah')
|
||||||
|
|
||||||
def testReNoEscapingUnpackListOfWrongSize(self):
|
def testReNoEscapingUnpackListOfWrongSize(self):
|
||||||
self.assertNotRegexp('re foo bar baz', 'unpack list of wrong size')
|
self.assertNotRegexp('re foo bar baz', 'unpack list of wrong size')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue