diff options
author | Leo Zhang <leo@leozhang.me> | 2021-08-08 22:14:55 -0700 |
---|---|---|
committer | Leo Zhang <leo@leozhang.me> | 2021-08-08 22:14:55 -0700 |
commit | 0b1ad269d109ec46e32910a09339832181e4eb43 (patch) | |
tree | db7fedc36ad1a78464ed2919b4295b37232ed547 /test/Xmobar/Plugins/Monitors | |
parent | 4eb262c3e3fb2db3e4e68be17613a51c764f0b00 (diff) | |
download | xmobar-0b1ad269d109ec46e32910a09339832181e4eb43.tar.gz xmobar-0b1ad269d109ec46e32910a09339832181e4eb43.tar.bz2 |
fix: padString should not make strings longer
Diffstat (limited to 'test/Xmobar/Plugins/Monitors')
-rw-r--r-- | test/Xmobar/Plugins/Monitors/CommonSpec.hs | 8 |
1 files changed, 7 insertions, 1 deletions
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 |