Increase coverage in evennia/utils/eveditor.
This commit is contained in:
parent
f1933b7dac
commit
22ef740577
1 changed files with 113 additions and 4 deletions
|
|
@ -181,7 +181,7 @@ class TestEvEditor(CommandTest):
|
||||||
)
|
)
|
||||||
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "")
|
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "")
|
||||||
|
|
||||||
def test_eveditor_DIGIT_COLON_DIGIT(self):
|
def test_eveditor_search_and_replace(self):
|
||||||
eveditor.EvEditor(self.char1)
|
eveditor.EvEditor(self.char1)
|
||||||
self.call(
|
self.call(
|
||||||
eveditor.CmdEditorGroup(),
|
eveditor.CmdEditorGroup(),
|
||||||
|
|
@ -199,10 +199,119 @@ class TestEvEditor(CommandTest):
|
||||||
raw_string="line 2.",
|
raw_string="line 2.",
|
||||||
msg="02line 2.",
|
msg="02line 2.",
|
||||||
)
|
)
|
||||||
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1.\nline 2.")
|
self.call(
|
||||||
|
eveditor.CmdLineInput(), "line 3.",
|
||||||
|
raw_string="line 3.",
|
||||||
|
msg="03line 3.",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"2:3",
|
||||||
|
cmdstring=":",
|
||||||
|
msg="Line Editor []\n02line 2.\n03line 3.\n[l:02 w:004 c:0015](:h for help)",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"1:2 line LINE",
|
||||||
|
cmdstring=":s",
|
||||||
|
msg="Search-replaced line -> LINE for lines 1-2.",
|
||||||
|
)
|
||||||
|
self.assertEqual(self.char1.ndb._eveditor.get_buffer(),
|
||||||
|
"LINE 1.\nLINE 2.\nline 3.")
|
||||||
|
|
||||||
|
def test_eveditor_COLON_DD(self):
|
||||||
|
eveditor.EvEditor(self.char1)
|
||||||
self.call(
|
self.call(
|
||||||
eveditor.CmdEditorGroup(),
|
eveditor.CmdEditorGroup(),
|
||||||
"",
|
"",
|
||||||
cmdstring="1:2",
|
cmdstring=":",
|
||||||
msg="",
|
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
|
||||||
)
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdLineInput(), "line 1.",
|
||||||
|
raw_string="line 1.",
|
||||||
|
msg="01line 1.",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdLineInput(), "line 2.",
|
||||||
|
raw_string="line 2.",
|
||||||
|
msg="02line 2.",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdLineInput(), "line 3.",
|
||||||
|
raw_string="line 3.",
|
||||||
|
msg="03line 3.",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"",
|
||||||
|
cmdstring=":DD",
|
||||||
|
msg="Cleared 3 lines from buffer.",
|
||||||
|
)
|
||||||
|
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "")
|
||||||
|
|
||||||
|
def test_eveditor_COLON_F(self):
|
||||||
|
eveditor.EvEditor(self.char1)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"",
|
||||||
|
cmdstring=":",
|
||||||
|
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdLineInput(), "line 1",
|
||||||
|
raw_string="line 1",
|
||||||
|
msg="01line 1",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"1:2",
|
||||||
|
cmdstring=":f",
|
||||||
|
msg="Flood filled lines 1-2.",
|
||||||
|
)
|
||||||
|
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1")
|
||||||
|
|
||||||
|
def test_eveditor_bad_commands(self):
|
||||||
|
eveditor.EvEditor(self.char1)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"",
|
||||||
|
cmdstring=":",
|
||||||
|
msg="Line Editor []\n01\n[l:01 w:000 c:0000](:h for help)",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdLineInput(), "line 1.",
|
||||||
|
raw_string="line 1.",
|
||||||
|
msg="01line 1.",
|
||||||
|
)
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"",
|
||||||
|
cmdstring=":dw",
|
||||||
|
msg="You must give a search word to delete.",
|
||||||
|
)
|
||||||
|
# self.call(
|
||||||
|
# eveditor.CmdEditorGroup(),
|
||||||
|
# raw_string="",
|
||||||
|
# cmdstring=":i",
|
||||||
|
# msg="You need to enter a new line and where to insert it.",
|
||||||
|
# )
|
||||||
|
# self.call(
|
||||||
|
# eveditor.CmdEditorGroup(),
|
||||||
|
# "",
|
||||||
|
# cmdstring=":I",
|
||||||
|
# msg="You need to enter text to insert.",
|
||||||
|
# )
|
||||||
|
# self.call(
|
||||||
|
# eveditor.CmdEditorGroup(),
|
||||||
|
# "",
|
||||||
|
# cmdstring=":r",
|
||||||
|
# msg="You need to enter a replacement string.",
|
||||||
|
# )
|
||||||
|
self.call(
|
||||||
|
eveditor.CmdEditorGroup(),
|
||||||
|
"",
|
||||||
|
cmdstring=":s",
|
||||||
|
msg="You must give a search word and something to replace it with.",
|
||||||
|
)
|
||||||
|
self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1.")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue