~singpolyma/haskell-libxml-sax

0f4c0960e1ba3b43e1fcd17661cbc0f814ae7911 — John Millikin 13 years ago 54eb406
Add a test that entity references in attribute content is expanded properly.
1 files changed, 17 insertions(+), 2 deletions(-)

M tests/Properties.hs
M tests/Properties.hs => tests/Properties.hs +17 -2
@@ 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))
	)
	[ ("<!DOCTYPE SOME_DOCTYPE [<!ENTITY ref \"some reference\">]>",
	  [


@@ 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))
	)
	[ ("<!DOCTYPE SOME_DOCTYPE [<!ENTITY ref \"some reference\">]>",
	  [
	  ])
	, ("<doc a='text &ref; text'/>",
	   [ 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