mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +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:
|
||||
raise SyntaxError, 'Missing ")"'
|
||||
elif token == ')':
|
||||
return ret
|
||||
if len(ret) > 1:
|
||||
return ret
|
||||
elif len(ret) == 1:
|
||||
return '(%s)' % ret[0]
|
||||
else:
|
||||
return '()'
|
||||
elif token == '(':
|
||||
ret.append(self._insideParens(lexer))
|
||||
elif token == '|':
|
||||
|
@ -37,6 +37,14 @@ except ImportError:
|
||||
sqlite = 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):
|
||||
plugins = ('MoobotFactoids', 'User', 'Utilities')
|
||||
def setUp(self):
|
||||
|
Loading…
Reference in New Issue
Block a user