import Data.Maybe import Data.Maybe.Justify import Data.Monoid import Test.Tasty import Test.Tasty.HUnit main :: IO () main = defaultMain tests tests :: TestTree tests = testGroup "Unit test" [ dataMaybeJustify ] dataMaybeJustify = testGroup "Data.Maybe.Justify" [ justifyId , maybeJustify ] justifyId = testGroup "justify fromJust isJust is id specialized for Maybe" [ justifyIdJust , justifyIdNothing ] justifyIdJust = testCase "Testing with Just" $ assertEqual "" (justify fromJust isJust (Just True)) (id (Just True)) justifyIdNothing = testCase "Testing with Nothing" $ assertEqual "" (justify fromJust isJust Nothing) (id Nothing :: Maybe Bool) maybeJustify = testCase "Can use justify with maybe" $ assertEqual "" (maybe "Default" (<> "!") (justify (<> " World") (/= mempty) "Hello")) ("Hello World!")