From 96ef293ab7b449b8eb7803607ad65e540358b164 Mon Sep 17 00:00:00 2001 From: Henddher Pedroza Date: Sun, 20 Oct 2019 19:31:24 -0400 Subject: [PATCH] Increase coverage in evennia/utils/eveditor. --- evennia/utils/tests/test_eveditor.py | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/evennia/utils/tests/test_eveditor.py b/evennia/utils/tests/test_eveditor.py index 200dc39259..17fd53073d 100644 --- a/evennia/utils/tests/test_eveditor.py +++ b/evennia/utils/tests/test_eveditor.py @@ -271,6 +271,58 @@ class TestEvEditor(CommandTest): ) self.assertEqual(self.char1.ndb._eveditor.get_buffer(), "line 1") + def test_eveditor_COLON_J(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.CmdLineInput(), "l 2", + raw_string="l 2", + msg="02l 2", + ) + self.call( + eveditor.CmdLineInput(), "l 3", + raw_string="l 3", + msg="03l 3", + ) + self.call( + eveditor.CmdLineInput(), "l 4", + raw_string="l 4", + msg="04l 4", + ) + self.call( + eveditor.CmdEditorGroup(), + "2 r", + cmdstring=":j", + msg="Right-justified line 2.", + ) + self.call( + eveditor.CmdEditorGroup(), + "3 c", + cmdstring=":j", + msg="Center-justified line 3.", + ) + self.call( + eveditor.CmdEditorGroup(), + "4 f", + cmdstring=":j", + msg="Full-justified line 4.", + ) + l1, l2, l3, l4 = tuple(self.char1.ndb._eveditor.get_buffer().split("\n")) + self.assertEqual(l1, "line 1") + self.assertEqual(l2, " " * 75 + "l 2") + self.assertEqual(l3, " " * 37 + "l 3" + " " * 38) + self.assertEqual(l4, "l" + " " * 76 + "4") + def test_eveditor_bad_commands(self): eveditor.EvEditor(self.char1) self.call(