aboutsummaryrefslogtreecommitdiff
path: root/spec/test
diff options
context:
space:
mode:
Diffstat (limited to 'spec/test')
-rw-r--r--spec/test/Thermoprint/PrintoutSpec.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/test/Thermoprint/PrintoutSpec.hs b/spec/test/Thermoprint/PrintoutSpec.hs
index 5a48496..b92d76a 100644
--- a/spec/test/Thermoprint/PrintoutSpec.hs
+++ b/spec/test/Thermoprint/PrintoutSpec.hs
@@ -1,9 +1,26 @@
1{-# LANGUAGE StandaloneDeriving #-}
2
1module Thermoprint.PrintoutSpec (spec) where 3module Thermoprint.PrintoutSpec (spec) where
2 4
3import Test.Hspec 5import Test.Hspec
4import Test.Hspec.QuickCheck (prop) 6import Test.Hspec.QuickCheck (prop)
5import Thermoprint.Printout 7import Thermoprint.Printout
6 8
9import Data.Aeson (fromJSON, ToJSON(..), Result(..))
10import Data.Function (on)
11
12import Control.DeepSeq (($!!), force)
13
14-- Equality via cotext on Block
15instance Eq Block where
16 (==) = (==) `on` cotext
17-- Structural equality for Chunk
18deriving instance Eq Chunk
19
7spec :: Spec 20spec :: Spec
8spec = do 21spec = do
9 prop "prop_text" prop_text 22 prop "prop_text" prop_text
23 prop "json" prop_json
24 where
25 prop_json :: Printout -> Bool
26 prop_json p = force $ (== Success p) . fromJSON . toJSON $!! p