tdewolff / parse

Go parsers for web formats
MIT License
413 stars 65 forks source link

Minify XML tests break with 2.4.0 #56

Closed QuLogic closed 4 years ago

QuLogic commented 4 years ago

An automated rebuild of minify against parse 2.4.0 fails as:

github.com/tdewolff/minify/xml
--- FAIL: TestXML (0.00s)
    --- FAIL: TestXML/<A>x</A> (0.00s)
    xml_test.go:56:: 
            <A>x</A>
            <Ax</A>
            <A>x</A>
    --- FAIL: TestXML/<a><b>x</b></a> (0.00s)
    xml_test.go:56:: 
            <a><b>x</b></a>
            <a<bx</b></a>
            <a><b>x</b></a>
    --- FAIL: TestXML/<a><b>x_y</b></a> (0.00s)
    xml_test.go:56:: 
            <a><b>x\ny</b></a>
            <a<bx\ny</b></a>
            <a><b>x\ny</b></a>
    --- FAIL: TestXML/<a>_<![CDATA[_a_]]>_</a> (0.00s)
    xml_test.go:56:: 
            <a> <![CDATA[ a ]]> </a>
            <aa</a>
            <a>a</a>
    --- FAIL: TestXML/<a_>a</a_> (0.00s)
    xml_test.go:56:: 
            <a >a</a >
            <aa</a>
            <a>a</a>
    --- FAIL: TestXML/<?xml__version="1.0"_?> (0.00s)
    xml_test.go:56:: 
            <?xml  version="1.0" ?>
            <?xml version="1.0"
            <?xml version="1.0"?>
    --- FAIL: TestXML/<x_a="_a_____b_"/> (0.00s)
    xml_test.go:56:: 
            <x a=" a \n\r\t b "/>
            <x a=" a     b "
            <x a=" a     b "/>
    --- FAIL: TestXML/<x>&amp;&lt;&gt;</x> (0.00s)
    xml_test.go:56:: 
            <x>&amp;&lt;&gt;</x>
            <x&amp;&lt;></x>
            <x>&amp;&lt;></x>
    --- FAIL: TestXML/<!doctype_html> (0.00s)
    xml_test.go:56:: 
            <!doctype html>
            <!doctype html=
            <!doctype html=>
    --- FAIL: TestXML/<x>_<!--y-->_</x> (0.00s)
    xml_test.go:56:: 
            <x>\n<!--y-->\n</x>
            <x</x>
            <x></x>
    --- FAIL: TestXML/<style>lala{color:red}</style> (0.00s)
    xml_test.go:56:: 
            <style>lala{color:red}</style>
            <stylelala{color:red}</style>
            <style>lala{color:red}</style>
--- FAIL: TestXMLKeepWhitespace (0.00s)
    --- FAIL: TestXMLKeepWhitespace/_<div>_<i>_test_</i>_<b>_test_</b>_</div>_ (0.00s)
    xml_test.go:84:: 
             <div> <i> test </i> <b> test </b> </div> 
            <div <i test </i> <b test </b> </div>
            <div> <i> test </i> <b> test </b> </div>
    --- FAIL: TestXMLKeepWhitespace/<x>_<!--y-->_</x> (0.00s)
    xml_test.go:84:: 
            <x>\n<!--y-->\n</x>
            <x\n</x>
            <x>\n</x>
    --- FAIL: TestXMLKeepWhitespace/<style>lala{color:red}</style> (0.00s)
    xml_test.go:84:: 
            <style>lala{color:red}</style>
            <stylelala{color:red}</style>
            <style>lala{color:red}</style>
    --- FAIL: TestXMLKeepWhitespace/<x>_<?xml?>_</x> (0.00s)
    xml_test.go:84:: 
            <x> <?xml?> </x>
            <x<?xml </x>
            <x><?xml?> </x>
    --- FAIL: TestXMLKeepWhitespace/<x>_<![CDATA[_x_]]>_</x> (0.00s)
    xml_test.go:84:: 
            <x> <![CDATA[ x ]]> </x>
            <x x </x>
            <x> x </x>
    --- FAIL: TestXMLKeepWhitespace/<x>_<![CDATA[_<<<<<_]]>_</x> (0.00s)
    xml_test.go:84:: 
            <x> <![CDATA[ <<<<< ]]> </x>
            <x<![CDATA[ <<<<< ]]></x>
            <x><![CDATA[ <<<<< ]]></x>
FAIL
exit status 1
FAIL    github.com/tdewolff/minify/xml  0.004s

The first tag seems to be missing its closing >.

tdewolff commented 4 years ago

You should make sure to use the correct versions of parse and minify. Either use the latest commit to master for both (not recommended due to breaking changes) or use the latest version of minify which currently uses parse@v2.3.14 (see go.mod). Hope that helps.

tdewolff commented 4 years ago

Actually, the release of minify against parse@v2.3.14 had the same issue due to an outstanding fix. I've published new versions of parse and minify that should work! Sorry for the hassle, reopen issue if you still experience problems.