git.iko.soy/typeable/html-parse
on master help sign in
Add a few test cases
commit1767d58fd8c1912593b22dcc5ce429723477f54b authorBen Gamari <ben@smart-cactus.org> dateWed 29 Nov 2017, 13:10 (9 years ago) parentdaf3127
1 file changed+8
tests/Text/HTML/ParserSpec.hs+8
tests/Text/HTML/ParserSpec.hs+8
@@ -100,3 +100,11 @@ spec = do
100100 describe "parseTokens" $ do
101101 it "works on `<h1>Heading</h1>`" $ do
102102 parseTokens "<h1>Heading</h1>" `shouldBe` [TagOpen "h1" [], ContentText "Heading", TagClose "h1"]
103+ it "terminates on truncated tags" $ do
104+ parseTokens "19 -167.44 <A HREF=\"http://walrus.wr.usgs" `shouldBe` [ContentText "19 -167.44 ", ContentText ""]
105+ it "parses comment correctly" $ do
106+ parseTokens "<!-- 3. Change Banner -->" `shouldBe` [Comment " 3. Change Banner "]
107+ it "parses commented tag correctly" $ do
108+ parseTokens "<!-- img src=\"/www_images/NCEP_GFS.gif\">" `shouldBe` [Comment " img src=\"/www_images/NCEP_GFS.gif\">"]
109+ it "parses funky comment" $ do
110+ parseTokens "<!-- img src=\"/www_images/NCEP_GFS.gif\"><!- -------------------------------------------------------- >" `shouldBe` [Comment " img src=\"/www_images/NCEP_GFS.gif\"><!- -------------------------------------------------------- >"]