hakyll/tests/Hakyll/Web/Html/RelativizeUrls/Tests.hs

38 lines
1.6 KiB
Haskell
Raw Normal View History

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>"
, "<img src=\"../../images/lolcat.png\" />" @=?
2012-11-20 10:50:22 +00:00
relativizeUrlsWith "../.." "<img src=\"/images/lolcat.png\" />"
2015-08-16 03:49:56 +00:00
, "<video poster=\"../../images/lolcat.png\"></video>" @=?
relativizeUrlsWith "../.."
"<video poster=\"/images/lolcat.png\"></video>"
2012-11-20 10:50:22 +00:00
, "<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>"
]