summaryrefslogtreecommitdiff
path: root/tests/Hakyll/Web/Urls/Relativize/Tests.hs
blob: 465d266a25ef84803fa2e8377044069382247ec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE OverloadedStrings #-}
module Hakyll.Web.Urls.Relativize.Tests
    ( tests
    ) where

import Test.Framework
import Test.HUnit hiding (Test)

import Hakyll.Web.Urls.Relativize
import TestSuite.Util

tests :: [Test]
tests = fromAssertions "relativizeUrls"
    [ "<a href=\"../foo\">bar</a>" @=?
        relativizeUrls ".." "<a href=\"/foo\">bar</a>"
    , "<img src=\"../../images/lolcat.png\"></img>" @=?
        relativizeUrls "../.." "<img src=\"/images/lolcat.png\" />"
    , "<a href=\"http://haskell.org\">Haskell</a>" @=?
        relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
    , "<a href=\"http://haskell.org\">Haskell</a>" @=?
        relativizeUrls "../.." "<a href=\"http://haskell.org\">Haskell</a>"
    , "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>" @=?
        relativizeUrls "../.."
            "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>"
    ]