From 0f4c0960e1ba3b43e1fcd17661cbc0f814ae7911 Mon Sep 17 00:00:00 2001 From: John Millikin Date: Mon, 4 Apr 2011 21:27:55 -0700 Subject: [PATCH] Add a test that entity references in attribute content is expanded properly. --- tests/Properties.hs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/Properties.hs b/tests/Properties.hs index 8719270..94a3d39 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -30,6 +30,7 @@ tests = [ test_Instruction , test_PlainCDATA , test_PassthroughCDATA , test_AttributeContent + , test_AttributeContentNoReference , test_AttributeOrder ] @@ -208,9 +209,7 @@ test_AttributeContent = test_Chunks "attribute content" let set cb st = SAX.setCallback p cb st set SAX.parsedBeginElement (\n as -> add (X.EventBeginElement n as)) set SAX.parsedEndElement (\n -> add (X.EventEndElement n)) - set SAX.parsedCharacters (\txt -> add (X.EventContent (X.ContentText txt))) set SAX.parsedReference (\name -> add (X.EventContent (X.ContentEntity name))) - set SAX.parsedCDATA (\txt -> add (X.EventCDATA txt)) ) [ ("]>", [ @@ -221,6 +220,22 @@ test_AttributeContent = test_Chunks "attribute content" ]) ] +test_AttributeContentNoReference :: F.Test +test_AttributeContentNoReference = test_Chunks "attribute content (no reference CB)" + (\p add -> do + let set cb st = SAX.setCallback p cb st + set SAX.parsedBeginElement (\n as -> add (X.EventBeginElement n as)) + set SAX.parsedEndElement (\n -> add (X.EventEndElement n)) + ) + [ ("]>", + [ + ]) + , ("", + [ X.EventBeginElement "doc" [("a", [X.ContentText "text some reference text"])] + , X.EventEndElement "doc" + ]) + ] + test_AttributeOrder :: F.Test test_AttributeOrder = test_Chunks "attribute order" (\p add -> do -- 2.45.2