mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Fix for bug #839053 (parens without bars not handled correctly).
This commit is contained in:
parent
830301570f
commit
9dd2680a9f
@ -79,7 +79,12 @@ class OptionList(object):
|
|||||||
if not token:
|
if not token:
|
||||||
raise SyntaxError, 'Missing ")"'
|
raise SyntaxError, 'Missing ")"'
|
||||||
elif token == ')':
|
elif token == ')':
|
||||||
|
if len(ret) > 1:
|
||||||
return ret
|
return ret
|
||||||
|
elif len(ret) == 1:
|
||||||
|
return '(%s)' % ret[0]
|
||||||
|
else:
|
||||||
|
return '()'
|
||||||
elif token == '(':
|
elif token == '(':
|
||||||
ret.append(self._insideParens(lexer))
|
ret.append(self._insideParens(lexer))
|
||||||
elif token == '|':
|
elif token == '|':
|
||||||
|
@ -37,6 +37,14 @@ except ImportError:
|
|||||||
sqlite = None
|
sqlite = None
|
||||||
|
|
||||||
if sqlite is not None:
|
if sqlite is not None:
|
||||||
|
MoobotFactoids = Owner.loadPluginModule('MoobotFactoids')
|
||||||
|
class OptionListTestCase(unittest.TestCase):
|
||||||
|
def testEmptyParens(self):
|
||||||
|
self.assertEqual(MoobotFactoids.tokenize('()'), ['()'])
|
||||||
|
|
||||||
|
def testNoBarParens(self):
|
||||||
|
self.assertEqual(MoobotFactoids.tokenize('(foo)'), ['(foo)'])
|
||||||
|
|
||||||
class FactoidsTestCase(PluginTestCase, PluginDocumentation):
|
class FactoidsTestCase(PluginTestCase, PluginDocumentation):
|
||||||
plugins = ('MoobotFactoids', 'User', 'Utilities')
|
plugins = ('MoobotFactoids', 'User', 'Utilities')
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user