mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Added tests to catch the pipeSyntax bug and to test G-Lite's new bracketSyntax
enabling/disabling.
This commit is contained in:
parent
708ee91776
commit
0b48743065
@ -74,11 +74,26 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
['foo', 'bar baz', 'quux'])
|
['foo', 'bar baz', 'quux'])
|
||||||
|
|
||||||
def testNesting(self):
|
def testNesting(self):
|
||||||
self.assertEqual(tokenize('[]'), [[]])
|
orig = conf.supybot.bracketSyntax()
|
||||||
self.assertEqual(tokenize('[foo]'), [['foo']])
|
try:
|
||||||
self.assertEqual(tokenize('foo [bar]'), ['foo', ['bar']])
|
conf.supybot.bracketSyntax.setValue(True)
|
||||||
self.assertEqual(tokenize('foo bar [baz quux]'),
|
self.assertEqual(tokenize('[]'), [[]])
|
||||||
['foo', 'bar', ['baz', 'quux']])
|
self.assertEqual(tokenize('[foo]'), [['foo']])
|
||||||
|
self.assertEqual(tokenize('[ foo ]'), [['foo']])
|
||||||
|
self.assertEqual(tokenize('foo [bar]'), ['foo', ['bar']])
|
||||||
|
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||||
|
['foo', 'bar', ['baz', 'quux']])
|
||||||
|
finally:
|
||||||
|
conf.supybot.bracketSyntax.setValue(orig)
|
||||||
|
try:
|
||||||
|
conf.supybot.bracketSyntax.setValue(False)
|
||||||
|
self.assertEqual(tokenize('[]'), ['[]'])
|
||||||
|
self.assertEqual(tokenize('[foo]'), ['[foo]'])
|
||||||
|
self.assertEqual(tokenize('foo [bar]'), ['foo', '[bar]'])
|
||||||
|
self.assertEqual(tokenize('foo bar [baz quux]'),
|
||||||
|
['foo', 'bar', '[baz', 'quux]'])
|
||||||
|
finally:
|
||||||
|
conf.supybot.bracketSyntax.setValue(orig)
|
||||||
|
|
||||||
def testError(self):
|
def testError(self):
|
||||||
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
self.assertRaises(SyntaxError, tokenize, '[foo') #]
|
||||||
@ -90,6 +105,7 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
self.assertRaises(SyntaxError, tokenize, '| foo')
|
self.assertRaises(SyntaxError, tokenize, '| foo')
|
||||||
self.assertRaises(SyntaxError, tokenize, 'foo ||bar')
|
self.assertRaises(SyntaxError, tokenize, 'foo ||bar')
|
||||||
self.assertRaises(SyntaxError, tokenize, 'bar |')
|
self.assertRaises(SyntaxError, tokenize, 'bar |')
|
||||||
|
self.assertEqual(tokenize('foo|bar'), ['bar', ['foo']])
|
||||||
self.assertEqual(tokenize('foo | bar'), ['bar', ['foo']])
|
self.assertEqual(tokenize('foo | bar'), ['bar', ['foo']])
|
||||||
self.assertEqual(tokenize('foo | bar | baz'),
|
self.assertEqual(tokenize('foo | bar | baz'),
|
||||||
['baz', ['bar',['foo']]])
|
['baz', ['bar',['foo']]])
|
||||||
@ -101,6 +117,12 @@ class TokenizerTestCase(SupyTestCase):
|
|||||||
['baz', 'quux', ['foo', 'bar']])
|
['baz', 'quux', ['foo', 'bar']])
|
||||||
finally:
|
finally:
|
||||||
conf.supybot.pipeSyntax.set('False')
|
conf.supybot.pipeSyntax.set('False')
|
||||||
|
self.assertEqual(tokenize('foo|bar'), ['foo|bar'])
|
||||||
|
self.assertEqual(tokenize('foo | bar'), ['foo', '|', 'bar'])
|
||||||
|
self.assertEqual(tokenize('foo | bar | baz'),
|
||||||
|
['foo', '|', 'bar', '|', 'baz'])
|
||||||
|
self.assertEqual(tokenize('foo bar | baz'),
|
||||||
|
['foo', 'bar', '|', 'baz'])
|
||||||
|
|
||||||
def testBold(self):
|
def testBold(self):
|
||||||
s = '\x02foo\x02'
|
s = '\x02foo\x02'
|
||||||
|
Loading…
Reference in New Issue
Block a user