mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Utilities: add countargs function, returns number of arguments supplied.
also add tests for it.
This commit is contained in:
parent
6381266cfd
commit
957998f483
@ -1,7 +1,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Supybot-fr\n"
|
"Project-Id-Version: Supybot-fr\n"
|
||||||
"POT-Creation-Date: 2011-02-20 11:27+CET\n"
|
"POT-Creation-Date: 2011-02-20 11:29+CET\n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: \n"
|
||||||
"Last-Translator: Valentin Lorentz <progval@gmail.com>\n"
|
"Last-Translator: Valentin Lorentz <progval@gmail.com>\n"
|
||||||
"Language-Team: Supybot-fr <progval@gmail.com>\n"
|
"Language-Team: Supybot-fr <progval@gmail.com>\n"
|
||||||
@ -91,6 +91,17 @@ msgstr ""
|
|||||||
|
|
||||||
#: plugin.py:122
|
#: plugin.py:122
|
||||||
msgid ""
|
msgid ""
|
||||||
|
"<arg> [<arg> ...]\n"
|
||||||
|
"\n"
|
||||||
|
" Counts the arguments given.\n"
|
||||||
|
" "
|
||||||
|
msgstr ""
|
||||||
|
"<argument> [<argument> ...]\n"
|
||||||
|
"\n"
|
||||||
|
"Retorune le nombre d'<argument>s donnés."
|
||||||
|
|
||||||
|
#: plugin.py:131
|
||||||
|
msgid ""
|
||||||
"<command> <text>\n"
|
"<command> <text>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Tokenizes <text> and calls <command> with the resulting arguments.\n"
|
" Tokenizes <text> and calls <command> with the resulting arguments.\n"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2011-02-20 11:27+CET\n"
|
"POT-Creation-Date: 2011-02-20 11:29+CET\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -82,6 +82,15 @@ msgstr ""
|
|||||||
#: plugin.py:122
|
#: plugin.py:122
|
||||||
#, docstring
|
#, docstring
|
||||||
msgid ""
|
msgid ""
|
||||||
|
"<arg> [<arg> ...]\n"
|
||||||
|
"\n"
|
||||||
|
" Counts the arguments given.\n"
|
||||||
|
" "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: plugin.py:131
|
||||||
|
#, docstring
|
||||||
|
msgid ""
|
||||||
"<command> <text>\n"
|
"<command> <text>\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Tokenizes <text> and calls <command> with the resulting arguments.\n"
|
" Tokenizes <text> and calls <command> with the resulting arguments.\n"
|
||||||
|
@ -117,6 +117,15 @@ class Utilities(callbacks.Plugin):
|
|||||||
irc.error('%s' % (e,))
|
irc.error('%s' % (e,))
|
||||||
sample = wrap(sample, ['positiveInt', many('anything')])
|
sample = wrap(sample, ['positiveInt', many('anything')])
|
||||||
|
|
||||||
|
@internationalizeDocstring
|
||||||
|
def countargs(self, irc, msg, args, things):
|
||||||
|
"""<arg> [<arg> ...]
|
||||||
|
|
||||||
|
Counts the arguments given.
|
||||||
|
"""
|
||||||
|
irc.reply(len(things))
|
||||||
|
countargs = wrap(countargs, [any('anything')])
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def apply(self, irc, msg, args, command, rest):
|
def apply(self, irc, msg, args, command, rest):
|
||||||
"""<command> <text>
|
"""<command> <text>
|
||||||
|
@ -65,4 +65,9 @@ class UtilitiesTestCase(PluginTestCase):
|
|||||||
self.assertError('sample 5 moo')
|
self.assertError('sample 5 moo')
|
||||||
self.assertRegexp('sample 2 a b c', '^[a-c] [a-c]$')
|
self.assertRegexp('sample 2 a b c', '^[a-c] [a-c]$')
|
||||||
|
|
||||||
|
def testCountargs(self):
|
||||||
|
self.assertResponse('countargs a b c', '3')
|
||||||
|
self.assertResponse('countargs a "b c"', '2')
|
||||||
|
self.assertResponse('countargs', '0')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
Reference in New Issue
Block a user