2012-11-20 10:50:22 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2011-02-09 18:57:25 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2011-09-06 20:26:07 +00:00
|
|
|
module Hakyll.Web.Urls.Relativize.Tests
|
2011-02-09 18:57:25 +00:00
|
|
|
( tests
|
|
|
|
) where
|
|
|
|
|
|
|
|
|
2012-11-20 10:50:22 +00:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
import Test.Framework (Test, testGroup)
|
|
|
|
import Test.HUnit ((@=?))
|
2011-02-09 18:57:25 +00:00
|
|
|
|
2012-11-20 10:50:22 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
import Hakyll.Web.Urls.Relativize
|
|
|
|
import TestSuite.Util
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
tests :: Test
|
|
|
|
tests = testGroup "Hakyll.Web.Urls.Relativize.Tests" $
|
|
|
|
fromAssertions "relativizeUrls"
|
|
|
|
[ "<a href=\"../foo\">bar</a>" @=?
|
|
|
|
relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>"
|
|
|
|
, "<img src=\"../../images/lolcat.png\"></img>" @=?
|
|
|
|
relativizeUrlsWith "../.." "<img src=\"/images/lolcat.png\" />"
|
|
|
|
, "<a href=\"http://haskell.org\">Haskell</a>" @=?
|
|
|
|
relativizeUrlsWith "../.."
|
|
|
|
"<a href=\"http://haskell.org\">Haskell</a>"
|
|
|
|
, "<a href=\"http://haskell.org\">Haskell</a>" @=?
|
|
|
|
relativizeUrlsWith "../.."
|
|
|
|
"<a href=\"http://haskell.org\">Haskell</a>"
|
|
|
|
, "<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>" @=?
|
|
|
|
relativizeUrlsWith "../.."
|
|
|
|
"<script src=\"//ajax.googleapis.com/jquery.min.js\"></script>"
|
|
|
|
]
|