From 229a137e34bb896b872dc6425bbfc02bad42cb85 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Wed, 21 Jun 2023 14:39:05 +0200 Subject: [PATCH] Messages - Added unit test for `hasIllegalCharacters(string)` --- source/birchwood/protocol/messages.d | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index 603708e..e91226e 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -608,4 +608,17 @@ public final class Message { return replyType; } +} + +version(unittest) +{ + // Contains illegal characters + string badString1 = "doos"~"bruh"~"lek"~cast(string)[10]~"ker"; + string badString2 = "doos"~"bruh"~"lek"~cast(string)[13]~"ker"; +} + +unittest +{ + assert(Message.hasIllegalCharacters(badString1) == true); + assert(Message.hasIllegalCharacters(badString2) == true); } \ No newline at end of file