gdritter repos telml / 6aa0c38
Added telml-markup test suite for future expansion Getty Ritter 7 years ago
3 changed file(s) with 59 addition(s) and 25 deletion(s). Collapse all Expand all
1 Name: telml-markup
2 Version: 0.0.0
3 Author: Getty Ritter <gettylefou@gmail.com>
4 Maintainer: Getty Ritter <gettylefou@gmail.com>
5 License: BSD3
6 License-File: LICENSE
1 name: telml-markup
2 version: 0.1.0.0
3 author: Getty Ritter <gettylefou@gmail.com>
4 maintainer: Getty Ritter <gettylefou@gmail.com>
5 license: BSD3
6 license-file: LICENSE
77 -- Synopsis:
88 -- Description:
9 Cabal-Version: >= 1.10
10 Build-Type: Simple
11 Extra-Source-Files: README.md, ChangeLog.md
9 cabal-version: >= 1.10
10 build-type: Simple
11 extra-source-files: README.md, ChangeLog.md
1212
13 Library
14 Default-Language: Haskell2010
15 GHC-Options: -Wall
16 Exposed-Modules: Data.TeLML.Markup
17 Build-Depends: base >= 4 && < 5, telml, blaze-markup, blaze-html, mtl
13 library
14 default-language: Haskell2010
15 ghc-options: -Wall
16 exposed-modules: Data.TeLML.Markup
17 build-depends: base >= 4 && < 5,
18 telml,
19 blaze-markup,
20 blaze-html,
21 mtl
1822
19 -- Test-Suite spec
20 -- Type: exitcode-stdio-1.0
21 -- Default-Language: Haskell2010
22 -- Hs-Source-Dirs: test
23 -- Ghc-Options: -Wall
24 -- Main-Is: Spec.hs
25 -- Build-Depends: base
26 -- , hspec
23 test-suite spec
24 type: exitcode-stdio-1.0
25 ghc-options: -Wall
26 hs-source-dirs: test
27 main-is: Spec.hs
28 build-depends: base == 4.*
29 , telml
30 , telml-markup
31 , hspec == 2.*
32 , blaze-markup
2733
28 Source-Repository head
29 Type: git
30 -- Location:
34 source-repository head
35 type: git
36 location: https://github.com/aisamanra/telml-markup
1 {-# OPTIONS_GHC -F -pgmF hspec-discover #-}
1 {-# LANGUAGE OverloadedStrings #-}
2
3 module Telml.MarkupSpec (main, spec) where
4
5 import Control.Monad ((>=>))
6 import Data.TeLML
7 import Data.TeLML.Markup
8 import Text.Blaze.Renderer.String (renderMarkup)
9
10 import Test.Hspec
11
12 main :: IO ()
13 main = hspec spec
14
15 doRender :: String -> Either String String
16 doRender = parse >=> render >=> return . renderMarkup
17
18 spec :: Spec
19 spec = do
20 describe "render" $ do
21 it "should emphasize" $ do
22 doRender "\\em{foo}" `shouldBe` Right "<p><em>foo</em></p>"
23 it "should embolden" $ do
24 doRender "\\strong{foo}" `shouldBe` Right "<p><strong>foo</strong></p>"
25 it "should lis" $ do
26 doRender "\\ul{\\li{one}\\li{two}}" `shouldBe`
27 Right "<p><ul><li>one</li><li>two</li></ul></p>"