2012-11-20 10:50:22 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2011-02-09 18:57:25 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2012-12-25 21:49:17 +00:00
|
|
|
module Hakyll.Web.Html.RelativizeUrls.Tests
|
2011-02-09 18:57:25 +00:00
|
|
|
( tests
|
|
|
|
) where
|
|
|
|
|
|
|
|
|
2012-11-20 10:50:22 +00:00
|
|
|
--------------------------------------------------------------------------------
|
2012-12-25 21:49:17 +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
|
|
|
--------------------------------------------------------------------------------
|
2012-12-25 21:49:17 +00:00
|
|
|
import Hakyll.Web.Html.RelativizeUrls
|
2012-11-20 10:50:22 +00:00
|
|
|
import TestSuite.Util
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
tests :: Test
|
2012-12-25 21:49:17 +00:00
|
|
|
tests = testGroup "Hakyll.Web.Html.RelativizeUrls.Tests" $
|
2012-11-20 10:50:22 +00:00
|
|
|
fromAssertions "relativizeUrls"
|
|
|
|
[ "<a href=\"../foo\">bar</a>" @=?
|
|
|
|
relativizeUrlsWith ".." "<a href=\"/foo\">bar</a>"
|
2012-11-28 09:24:09 +00:00
|
|
|
, "<img src=\"../../images/lolcat.png\" />" @=?
|
2012-11-20 10:50:22 +00:00
|
|
|
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>"
|
|
|
|
]
|