git.iko.soy/typeable/pandoc
on 696dfbc help sign in
30 lines 1.5 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module Tests.Readers.HTML (tests) where
4import Text.Pandoc.Definition
5import Test.Framework
6import Tests.Helpers
7import Text.Pandoc.Arbitrary()
8import Text.Pandoc.Builder
9import Text.Pandoc
10import Text.Pandoc.Error
12html :: String -> Pandoc
13html = handleError . readHtml def
15tests :: [Test]
16tests = [ testGroup "base tag"
17 [ test html "simple" $
18 "<head><base href=\"http://www.w3schools.com/images/foo\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
19 plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
20 , test html "slash at end of base" $
21 "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"stickman.gif\" alt=\"Stickman\"></head>" =?>
22 plain (image "http://www.w3schools.com/images/stickman.gif" "" (text "Stickman"))
23 , test html "slash at beginning of href" $
24 "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"/stickman.gif\" alt=\"Stickman\"></head>" =?>
25 plain (image "http://www.w3schools.com/stickman.gif" "" (text "Stickman"))
26 , test html "absolute URL" $
27 "<head><base href=\"http://www.w3schools.com/images/\" ></head><body><img src=\"http://example.com/stickman.gif\" alt=\"Stickman\"></head>" =?>
28 plain (image "http://example.com/stickman.gif" "" (text "Stickman"))
29 ]
30 ]