diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-10 04:43:42 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-10 04:43:42 +0000 |
commit | 6ec3c805ea2cd629a75641530de30ab39a191409 (patch) | |
tree | 9a63c2edbe6834a17a67b055279024b7ec31eb3a /spec/test/Thermoprint | |
parent | 0bb617ff93d242d20e9e63f44664f38a653898d4 (diff) | |
download | thermoprint-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')
-rw-r--r-- | spec/test/Thermoprint/PrintoutSpec.hs | 17 |
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 | |||
1 | module Thermoprint.PrintoutSpec (spec) where | 3 | module Thermoprint.PrintoutSpec (spec) where |
2 | 4 | ||
3 | import Test.Hspec | 5 | import Test.Hspec |
4 | import Test.Hspec.QuickCheck (prop) | 6 | import Test.Hspec.QuickCheck (prop) |
5 | import Thermoprint.Printout | 7 | import Thermoprint.Printout |
6 | 8 | ||
9 | import Data.Aeson (fromJSON, ToJSON(..), Result(..)) | ||
10 | import Data.Function (on) | ||
11 | |||
12 | import Control.DeepSeq (($!!), force) | ||
13 | |||
14 | -- Equality via cotext on Block | ||
15 | instance Eq Block where | ||
16 | (==) = (==) `on` cotext | ||
17 | -- Structural equality for Chunk | ||
18 | deriving instance Eq Chunk | ||
19 | |||
7 | spec :: Spec | 20 | spec :: Spec |
8 | spec = do | 21 | spec = 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 | ||