X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhalcyon.git;a=blobdiff_plain;f=src%2FHtml.hs;h=2f9332522292d34bbed8f7d4abc8d8a890e09ea8;hp=1c9a4285541c720c2c413166f606cb15d5abdc46;hb=4cc476a2714260980899ca5358196bbf5226b3c2;hpb=e565ae841fa735a1361712eac06cc7ae9be098dc diff --git a/src/Html.hs b/src/Html.hs index 1c9a428..2f93325 100644 --- a/src/Html.hs +++ b/src/Html.hs @@ -1,7 +1,9 @@ module Html where -import Test.HUnit +import Test.Framework (Test, testGroup) +import Test.Framework.Providers.HUnit (testCase) +import Test.HUnit (Assertion, assertEqual) import Text.HTML.TagSoup.Entity (lookupEntity) replace_entities :: String -> String @@ -14,21 +16,26 @@ replace_entities ('&':xs) = replace_entities (x:xs) = x : replace_entities xs -html_tests :: [Test] -html_tests = [ test_replace_entities ] +html_tests :: Test +html_tests = + testGroup "HTML Tests" [ tc1 ] + where + tc1 = testCase + "All entities are replaced correctly." + test_replace_entities -test_replace_entities :: Test +test_replace_entities :: Assertion test_replace_entities = - TestCase $ assertEqual description expected_text actual_text - where - description = "All entities are replaced correctly." - actual_text = - replace_entities $ - ""The moon is gay……" " ++ - "said <insert the current president of the " ++ - "United States of America>. “It’s " ++ - "OK—–he’s not a real doctor.”" - expected_text = - "\"The moon is gay……\" said . " ++ - "“It’s OK—–he’s not a real doctor.”" + assertEqual description expected_text actual_text + where + description = "All entities are replaced correctly." + actual_text = + replace_entities $ + ""The moon is gay……" " ++ + "said <insert the current president of the " ++ + "United States of America>. “It’s " ++ + "OK—–he’s not a real doctor.”" + expected_text = + "\"The moon is gay……\" said . " ++ + "“It’s OK—–he’s not a real doctor.”"