In @desc command, validate rhs based on = sign present in orig args. Default MUX parsing assigns None to rhs if there is nothing on the right of the = sign.

This commit is contained in:
Henddher Pedroza 2018-10-16 19:49:19 -05:00
parent 6b96e84fd0
commit dc44dc0176
2 changed files with 6 additions and 2 deletions

View file

@ -589,12 +589,12 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
self.edit_handler()
return
if self.rhs:
if '=' in self.args:
# We have an =
obj = caller.search(self.lhs)
if not obj:
return
desc = self.rhs
desc = self.rhs or ''
else:
obj = caller.location or self.msg("|rYou can't describe oblivion.|n")
if not obj:

View file

@ -264,6 +264,9 @@ class TestBuilding(CommandTest):
self.call(building.CmdDesc(), "Obj2=TestDesc", "The description was set on Obj2(#5).")
def test_empty_desc(self):
"""
empty desc sets desc as ''
"""
o2d = self.obj2.db.desc
r1d = self.room1.db.desc
self.call(building.CmdDesc(), "Obj2=", "The description was set on Obj2(#5).")
@ -271,6 +274,7 @@ class TestBuilding(CommandTest):
assert self.room1.db.desc == r1d
def test_desc_default_to_room(self):
"""no rhs changes room's desc"""
o2d = self.obj2.db.desc
r1d = self.room1.db.desc
self.call(building.CmdDesc(), "Obj2", "The description was set on Room(#1).")