{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE QuasiQuotes #-} module Examples ( testExamples ) where import Test.Framework ( Test , testGroup ) import Test.Framework.Providers.HUnit ( testCase ) import Test.HUnit ( assertEqual ) import Data.Text ( Text ) import qualified Data.Text as T ( pack ) import Zenacy.HTML testExamples :: Test testExamples = testGroup "Examples" [ testMisnested , testUnexpected , testUnclosed ] testMisnested :: Test testMisnested = testCase "Misnested tags" $ do flip (assertEqual "13.2.10.1 Misnested tags") (htmlRender $ htmlParseEasy "

12345

") "

12345

" flip (assertEqual "13.2.10.2 Misnested tags") (htmlRender $ htmlParseEasy "1

23

") "1

23

" testUnexpected :: Test testUnexpected = testCase "Unexpected markup in tables" $ do flip (assertEqual "13.2.10.3 Unexpected markup in tables") (htmlRender $ htmlParseEasy "bbb
aaa
ccc") "\ \bbb
aaa
ccc\ \" testUnclosed :: Test testUnclosed = testCase "Unclosed formatting elements" $ do flip (assertEqual "13.2.10.6 Unclosed formatting elements") (htmlRender $ htmlParseEasy "\ \

X\ \

X\ \

X\ \

X") "\ \

\ \\ \\ \\ \\ \\ \X\ \\ \\ \\ \\ \\ \

\ \

\ \\ \\ \\ \\ \X\ \\ \\ \\ \\ \

\ \

\ \\ \\ \\ \\ \\ \\ \\ \X\ \\ \\ \\ \\ \\ \\ \\ \

\ \

X

\ \"