Utilities: Add @concat command

This commit is contained in:
Valentin Lorentz 2012-09-30 11:02:12 +00:00
parent 45e6b7be7a
commit 75f9917f86
2 changed files with 14 additions and 0 deletions

View File

@ -67,6 +67,15 @@ class Utilities(callbacks.Plugin):
irc.replySuccess(text)
success = wrap(success, [additional('text')])
@internationalizeDocstring
def concat(self, irc, msg, args, things):
"""<arg> [<arg> ...]
Concatenates all arguments.
"""
irc.reply(''.join(things))
concat = wrap(concat, [many('anything')])
@internationalizeDocstring
def last(self, irc, msg, args):
"""<text> [<text> ...]

View File

@ -39,6 +39,11 @@ class UtilitiesTestCase(PluginTestCase):
self.assertNotError('success 1')
self.assertError('success [re m/foo bar]')
def testConcat(self):
self.assertResponse('concat foo bar', 'foobar')
self.assertResponse('concat [echo foo] [echo bar]', 'foobar')
self.assertResponse('concat "foo bar"', 'foo bar')
def testLast(self):
self.assertResponse('utilities last foo bar baz', 'baz')