mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 04:32:36 +01:00
Removed final remnants of bracketSyntax.
This commit is contained in:
parent
278310e999
commit
88b966306a
@ -278,12 +278,6 @@ registerGlobalValue(supybot.reply, 'oneToOne',
|
|||||||
safety purposes (so the bot can't possibly flood) it will normally send
|
safety purposes (so the bot can't possibly flood) it will normally send
|
||||||
everything in a single message."""))
|
everything in a single message."""))
|
||||||
|
|
||||||
registerChannelValue(supybot.reply, 'bracketSyntax',
|
|
||||||
registry.Boolean(True, """Supybot allows nested commands. If this option is
|
|
||||||
enabled, users can nest commands using a bracket syntax, for example: 'bot:
|
|
||||||
bar [foo]'. The matching left/right characters used for nesting commands
|
|
||||||
can be set via the supybot.reply.brackets"""))
|
|
||||||
|
|
||||||
class ValidBrackets(registry.OnlySomeStrings):
|
class ValidBrackets(registry.OnlySomeStrings):
|
||||||
validStrings = ('', '[]', '<>', '{}', '()')
|
validStrings = ('', '[]', '<>', '{}', '()')
|
||||||
|
|
||||||
|
@ -74,26 +74,22 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
['foo', 'bar baz', 'quux'])
|
['foo', 'bar baz', 'quux'])
|
||||||
|
|
||||||
def testNesting(self):
|
def testNesting(self):
|
||||||
orig = conf.supybot.reply.bracketSyntax()
|
|
||||||
try:
|
|
||||||
conf.supybot.reply.bracketSyntax.setValue(True)
|
|
||||||
self.assertEqual(tokenize('[]'), [[]])
|
self.assertEqual(tokenize('[]'), [[]])
|
||||||
self.assertEqual(tokenize('[foo]'), [['foo']])
|
self.assertEqual(tokenize('[foo]'), [['foo']])
|
||||||
self.assertEqual(tokenize('[ foo ]'), [['foo']])
|
self.assertEqual(tokenize('[ foo ]'), [['foo']])
|
||||||
self.assertEqual(tokenize('foo [bar]'), ['foo', ['bar']])
|
self.assertEqual(tokenize('foo [bar]'), ['foo', ['bar']])
|
||||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||||
['foo', 'bar', ['baz', 'quux']])
|
['foo', 'bar', ['baz', 'quux']])
|
||||||
finally:
|
|
||||||
conf.supybot.reply.bracketSyntax.setValue(orig)
|
|
||||||
try:
|
try:
|
||||||
conf.supybot.reply.bracketSyntax.setValue(False)
|
orig = conf.supybot.reply.brackets()
|
||||||
|
conf.supybot.reply.brackets.setValue('')
|
||||||
self.assertEqual(tokenize('[]'), ['[]'])
|
self.assertEqual(tokenize('[]'), ['[]'])
|
||||||
self.assertEqual(tokenize('[foo]'), ['[foo]'])
|
self.assertEqual(tokenize('[foo]'), ['[foo]'])
|
||||||
self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]'])
|
self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]'])
|
||||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||||
['foo', 'bar', '[baz', 'quux]'])
|
['foo', 'bar', '[baz', 'quux]'])
|
||||||
finally:
|
finally:
|
||||||
conf.supybot.reply.bracketSyntax.setValue(orig)
|
conf.supybot.reply.brackets.setValue(orig)
|
||||||
|
|
||||||
def testError(self):
|
def testError(self):
|
||||||
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
||||||
|
Loading…
Reference in New Issue
Block a user