From 0b1ad269d109ec46e32910a09339832181e4eb43 Mon Sep 17 00:00:00 2001
From: Leo Zhang <leo@leozhang.me>
Date: Sun, 8 Aug 2021 22:14:55 -0700
Subject: fix: padString should not make strings longer

---
 test/Xmobar/Plugins/Monitors/CommonSpec.hs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'test')

diff --git a/test/Xmobar/Plugins/Monitors/CommonSpec.hs b/test/Xmobar/Plugins/Monitors/CommonSpec.hs
index 84cfbf3..578b1a5 100644
--- a/test/Xmobar/Plugins/Monitors/CommonSpec.hs
+++ b/test/Xmobar/Plugins/Monitors/CommonSpec.hs
@@ -13,7 +13,7 @@ spec :: Spec
 spec =
   describe "Common.padString" $ do
     it "returns given string when called with default values" $
-      do padString 0 0 "" False "" "test" `shouldBe` "test"
+      padString 0 0 "" False "" "test" `shouldBe` "test"
 
     it "truncates to max width" $ do
       let maxw = 3
@@ -27,3 +27,9 @@ spec =
           ellipsis = "..."
           expectedStr = (++ ellipsis) . take 3 $ givenStr
       padString 0 maxw "" False ellipsis givenStr `shouldBe` expectedStr
+
+    it "does not pad empty strings" $ do
+      let padChars = " "
+          givenStr = ""
+          expectedStr = ""
+      padString 0 0 padChars False "" givenStr `shouldBe` expectedStr
-- 
cgit v1.2.3