mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Allow ambiguous aliases.
This commit is contained in:
parent
94cdec8a26
commit
7f7562ef42
@ -217,9 +217,10 @@ class Alias(callbacks.Privmsg):
|
||||
raise AliasError, s
|
||||
name = realName
|
||||
cbs = callbacks.findCallbackForCommand(irc, name)
|
||||
if [cb for cb in cbs if cb != self]:
|
||||
s = 'A command with the name %r already exists.' % name
|
||||
raise AliasError, s
|
||||
if self in cbs:
|
||||
if hasattr(self, realName) and realName not in self.aliases:
|
||||
s = 'You can\'t overwrite commands in this plugin.'
|
||||
raise AliasError, s
|
||||
if name in self.aliases:
|
||||
(currentAlias, locked) = self.aliases[name]
|
||||
if locked and currentAlias != alias:
|
||||
|
@ -67,6 +67,13 @@ class FunctionsTest(unittest.TestCase):
|
||||
|
||||
class AliasTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
plugins = ('Alias', 'Fun', 'Utilities')
|
||||
def testDoesNotOverwriteCommands(self):
|
||||
self.assertError('alias add alias "echo foo bar baz"')
|
||||
self.assertError('alias add add "echo foo bar baz"')
|
||||
self.assertError('alias add remove "echo foo bar baz"')
|
||||
self.assertError('alias add lock "echo foo bar baz"')
|
||||
self.assertError('alias add unlock "echo foo bar baz"')
|
||||
|
||||
def testAliasHelp(self):
|
||||
self.assertNotError('alias add slashdot foo')
|
||||
self.assertRegexp('help slashdot', "Alias for 'foo'")
|
||||
|
Loading…
Reference in New Issue
Block a user