diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Spec.hs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Spec.hs b/test/Spec.hs new file mode 100644 index 0000000..298eb04 --- /dev/null +++ b/test/Spec.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE ScopedTypeVariables #-} +import Test.QuickCheck +import Test.Hspec +import Blessings + +instance Arbitrary a => Arbitrary (Blessings a) where + arbitrary = + oneof + [ Plain <$> arbitrary + , pure Empty + , (<>) <$> arbitrary <*> arbitrary + , SGR <$> arbitrary <*> arbitrary + ] + +main :: IO () +main = + hspec $ do + describe "Blessings" $ do + it "obeys the Semigroup laws" $ + property $ \(x :: Blessings String) y z -> + (x <> y) <> z == x <> (y <> z) + + it "obeys the Monoid laws" $ + property $ \(x :: Blessings String) -> + x <> mempty == x && x == mempty <> x |