mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Aka: Fix combination of required and optional arguments.
Was broken by 7f43727835
(why?)
This commit is contained in:
parent
b00081f6c9
commit
5272bf3a86
@ -467,6 +467,7 @@ class Aka(callbacks.Plugin):
|
|||||||
replace(tokens, lambda s: dollarRe.sub(regexpReplace, s))
|
replace(tokens, lambda s: dollarRe.sub(regexpReplace, s))
|
||||||
if biggestAt:
|
if biggestAt:
|
||||||
assert not wildcard
|
assert not wildcard
|
||||||
|
args = args[biggestDollar:]
|
||||||
replace(tokens, lambda s: atRe.sub(regexpReplace, s))
|
replace(tokens, lambda s: atRe.sub(regexpReplace, s))
|
||||||
if wildcard:
|
if wildcard:
|
||||||
assert not biggestAt
|
assert not biggestAt
|
||||||
|
@ -135,6 +135,11 @@ class AkaChannelTestCase(ChannelPluginTestCase):
|
|||||||
self.assertResponse('myrepr foo', '"foo"')
|
self.assertResponse('myrepr foo', '"foo"')
|
||||||
self.assertResponse('myrepr ""', '""')
|
self.assertResponse('myrepr ""', '""')
|
||||||
|
|
||||||
|
def testRequiredAndOptional(self):
|
||||||
|
self.assertNotError('aka add reqopt "echo req=$1, opt=@1"')
|
||||||
|
self.assertResponse('reqopt foo bar', 'req=foo, opt=bar')
|
||||||
|
self.assertResponse('reqopt foo', 'req=foo, opt=')
|
||||||
|
|
||||||
def testNoExtraSpaces(self):
|
def testNoExtraSpaces(self):
|
||||||
self.assertNotError('aka add foo "action takes $1\'s money"')
|
self.assertNotError('aka add foo "action takes $1\'s money"')
|
||||||
self.assertResponse('foo bar', '\x01ACTION takes bar\'s money\x01')
|
self.assertResponse('foo bar', '\x01ACTION takes bar\'s money\x01')
|
||||||
|
Loading…
Reference in New Issue
Block a user