implemented centre

This commit is contained in:
Jonathan Lamothe
2019-09-02 09:54:04 -04:00
parent 6145dd5c0c
commit 8b88cbff75
2 changed files with 26 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ spec = describe "Mtlstats.Format" $ do
padNumSpec
leftSpec
rightSpec
centreSpec
padNumSpec :: Spec
padNumSpec = describe "padNum" $ do
@@ -75,3 +76,14 @@ rightSpec = describe "right" $ do
context "overflow" $
it "should truncate the text" $
right 2 "foo" `shouldBe` "oo"
centreSpec :: Spec
centreSpec = describe "centre" $ do
context "fit" $
it "should pad the text" $
centre 5 "foo" `shouldBe` " foo "
context "overflow" $
it "should truncate the text" $
centre 2 "foo" `shouldBe` "fo"