diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-18 12:09:36 +0000 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-18 12:09:36 +0000 |
| commit | 57c56564d15cd5c83a4f1d1bab5490e6b75e8656 (patch) | |
| tree | 55ea741665155b46b9e599b149dee3323fe479c0 /spec/test | |
| parent | 9435083465a487553b21c599c1340aa5e5ed8a1c (diff) | |
| download | thermoprint-57c56564d15cd5c83a4f1d1bab5490e6b75e8656.tar thermoprint-57c56564d15cd5c83a4f1d1bab5490e6b75e8656.tar.gz thermoprint-57c56564d15cd5c83a4f1d1bab5490e6b75e8656.tar.bz2 thermoprint-57c56564d15cd5c83a4f1d1bab5490e6b75e8656.tar.xz thermoprint-57c56564d15cd5c83a4f1d1bab5490e6b75e8656.zip | |
Moved Printout.BBCode to own module
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 | ||
