diff options
Diffstat (limited to 'spec/test')
-rw-r--r-- | spec/test/Thermoprint/Printout/BBCodeSpec.hs | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/spec/test/Thermoprint/Printout/BBCodeSpec.hs b/spec/test/Thermoprint/Printout/BBCodeSpec.hs deleted file mode 100644 index f3f1840..0000000 --- a/spec/test/Thermoprint/Printout/BBCodeSpec.hs +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | {-# LANGUAGE OverloadedStrings, OverloadedLists #-} | ||
2 | {-# LANGUAGE StandaloneDeriving #-} | ||
3 | |||
4 | module Thermoprint.Printout.BBCodeSpec (spec) where | ||
5 | |||
6 | import Test.Hspec | ||
7 | import Test.Hspec.QuickCheck (prop) | ||
8 | import Test.QuickCheck.Instances | ||
9 | |||
10 | import Thermoprint.Printout.BBCode | ||
11 | import Thermoprint.Printout | ||
12 | |||
13 | import Data.Text (Text) | ||
14 | |||
15 | import Control.Monad (zipWithM_) | ||
16 | import Data.Monoid ((<>)) | ||
17 | import Data.Function (on) | ||
18 | |||
19 | import qualified Data.Sequence as Seq (fromList) | ||
20 | |||
21 | instance Eq Block where | ||
22 | (==) = (==) `on` cotext | ||
23 | deriving instance Eq Chunk | ||
24 | |||
25 | spec :: Spec | ||
26 | spec = do | ||
27 | zipWithM_ example [1..] examples | ||
28 | where | ||
29 | example n (s, ts) = let str = "Example " <> show n | ||
30 | in specify str $ bbcode s == (pOut <$> ts) | ||
31 | |||
32 | pOut :: [Block] -> Printout | ||
33 | pOut = pure . Seq.fromList . map Cooked | ||
34 | |||
35 | examples :: [(Text, Either BBCodeError [Block])] | ||
36 | examples = [ ("Hello World!" | ||
37 | , Right [Line (JuxtaPos [word "Hello", HSpace 1, word "World!"])]) | ||
38 | , ("Hello [hspace width=2/] World!" | ||
39 | , Right [Line (JuxtaPos [word "Hello", HSpace 4, word "World!"])]) | ||
40 | ] | ||
41 | where | ||
42 | word = (\(Right l) -> l) . text | ||