aboutsummaryrefslogtreecommitdiff
path: root/spec/test/Thermoprint/PrintoutSpec.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-01-10 04:43:42 +0000
committerGregor Kleen <gkleen@yggdrasil.li>2016-01-10 04:43:42 +0000
commit6ec3c805ea2cd629a75641530de30ab39a191409 (patch)
tree9a63c2edbe6834a17a67b055279024b7ec31eb3a /spec/test/Thermoprint/PrintoutSpec.hs
parent0bb617ff93d242d20e9e63f44664f38a653898d4 (diff)
downloadthermoprint-6ec3c805ea2cd629a75641530de30ab39a191409.tar
thermoprint-6ec3c805ea2cd629a75641530de30ab39a191409.tar.gz
thermoprint-6ec3c805ea2cd629a75641530de30ab39a191409.tar.bz2
thermoprint-6ec3c805ea2cd629a75641530de30ab39a191409.tar.xz
thermoprint-6ec3c805ea2cd629a75641530de30ab39a191409.zip
First stab at API
Diffstat (limited to 'spec/test/Thermoprint/PrintoutSpec.hs')
-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