Merge pull request #1691 from Henddher/bug_1499
Bug 1499: [READY FOR REVIEW AND MERGE] No way to clear object descs without resulting to `@py`
This commit is contained in:
commit
03b6621b99
2 changed files with 20 additions and 2 deletions
|
|
@ -612,12 +612,12 @@ class CmdDesc(COMMAND_DEFAULT_CLASS):
|
||||||
self.edit_handler()
|
self.edit_handler()
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.rhs:
|
if '=' in self.args:
|
||||||
# We have an =
|
# We have an =
|
||||||
obj = caller.search(self.lhs)
|
obj = caller.search(self.lhs)
|
||||||
if not obj:
|
if not obj:
|
||||||
return
|
return
|
||||||
desc = self.rhs
|
desc = self.rhs or ''
|
||||||
else:
|
else:
|
||||||
obj = caller.location or self.msg("|rYou can't describe oblivion.|n")
|
obj = caller.location or self.msg("|rYou can't describe oblivion.|n")
|
||||||
if not obj:
|
if not obj:
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,24 @@ class TestBuilding(CommandTest):
|
||||||
def test_desc(self):
|
def test_desc(self):
|
||||||
self.call(building.CmdDesc(), "Obj2=TestDesc", "The description was set on Obj2(#5).")
|
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).")
|
||||||
|
assert self.obj2.db.desc == '' and self.obj2.db.desc != o2d
|
||||||
|
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).")
|
||||||
|
assert self.obj2.db.desc == o2d
|
||||||
|
assert self.room1.db.desc == 'Obj2' and self.room1.db.desc != r1d
|
||||||
|
|
||||||
def test_wipe(self):
|
def test_wipe(self):
|
||||||
confirm = building.CmdDestroy.confirm
|
confirm = building.CmdDestroy.confirm
|
||||||
building.CmdDestroy.confirm = False
|
building.CmdDestroy.confirm = False
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue