From f98542e884fdc0cb77c1b33da500dac577761f5d Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 5 Mar 2021 21:11:37 +0100 Subject: [PATCH] Add testReplyInstant I'm going to mess with instant replies to add support for multiline, so it's good to have a safety net. --- test/test_callbacks.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/test_callbacks.py b/test/test_callbacks.py index 4547eee0e..078d8b927 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -534,6 +534,35 @@ class PrivmsgTestCase(ChannelPluginTestCase): self.assertRegexp('help first firstcmd', 'First', 0) # no re.I flag. self.assertRegexp('help firstrepeat firstcmd', 'FirstRepeat', 0) + def testReplyInstant(self): + self.assertNoResponse(' ') + print(conf.supybot.reply.mores.instant()) + self.assertResponse( + "eval 'foo '*300", + "'" + "foo " * 110 + " \x02(2 more messages)\x02") + self.assertNoResponse(' ') + + with conf.supybot.reply.mores.instant.context(2): + self.assertResponse( + "eval 'foo '*300", + "'" + "foo " * 110 + " \x02(2 more messages)\x02") + self.assertResponse( + " ", + "foo " * 111 + "\x02(1 more message)\x02") + self.assertNoResponse(" ") + + with conf.supybot.reply.mores.instant.context(3): + self.assertResponse( + "eval 'foo '*300", + "'" + "foo " * 110 + " \x02(2 more messages)\x02") + self.assertResponse( + " ", + "foo " * 111 + "\x02(1 more message)\x02") + self.assertResponse( + " ", + " " + "foo " * 79 + "'") + self.assertNoResponse(" ") + def testClientTagReply(self): self.irc.addCallback(self.First(self.irc))