diff --git a/tests/stdlib/thtmlparser2814.nim b/tests/stdlib/thtmlparser2814.nim new file mode 100644 index 0000000000..74c1a95563 --- /dev/null +++ b/tests/stdlib/thtmlparser2814.nim @@ -0,0 +1,38 @@ +discard """ + output: "@[]" +""" +import htmlparser +import xmltree +import strutils +from streams import newStringStream + + +## builds the two cases below and test that +## ``//[dd,li]`` has "

that

" as children +## +##
+##
this
+##
+##

that

+##
+##
+ +## +## + +for ltype in [["dl","dd"], ["ul","li"]]: + let desc_item = if ltype[0]=="dl": "
this
" else: "" + let item = "$1<$2>

that

" % [desc_item, ltype[1]] + let list = """ <$1> + $2 + """ % [ltype[0], item] + + var errors : seq[string] = @[] + + let parseH = parseHtml(newStringStream(list),"statichtml", errors =errors) + + echo $parseH.findAll(ltype[1])[0].child("p") == "

that

"