@@ -153,6 +153,36 @@ def test_node_context_parsing_of_malformed_html_fragment_without_recover_is_not_
153153 end
154154 end
155155
156+ def test_node_context_parsing_of_malformed_html_fragment_without_recover_is_not_corrected_keyword
157+ skip ( "libxml2 2.14.0 no longer raises this error" ) if Nokogiri . uses_libxml? ( ">= 2.14.0" )
158+
159+ doc = HTML4 . parse ( "<html><body><div></div></body></html>" )
160+ context_node = doc . at_css ( "div" )
161+ assert_raises ( Nokogiri ::XML ::SyntaxError ) do
162+ context_node . parse ( "<div </div>" , options : ParseOptions . new )
163+ end
164+ end
165+
166+ def test_node_context_parsing_of_malformed_xml_fragment_without_recover_is_not_corrected
167+ skip ( "libxml2 2.14.0 no longer raises this error" ) if Nokogiri . uses_libxml? ( ">= 2.14.0" )
168+
169+ doc = XML . parse ( "<root><body><div></div></body></roo" )
170+ context_node = doc . at_css ( "div" )
171+ assert_raises ( Nokogiri ::XML ::SyntaxError ) do
172+ context_node . parse ( "<div </div>" , &:strict )
173+ end
174+ end
175+
176+ def test_node_context_parsing_of_malformed_xml_fragment_without_recover_is_not_corrected_keyword
177+ skip ( "libxml2 2.14.0 no longer raises this error" ) if Nokogiri . uses_libxml? ( ">= 2.14.0" )
178+
179+ doc = XML . parse ( "<root><body><div></div></body></roo" )
180+ context_node = doc . at_css ( "div" )
181+ assert_raises ( Nokogiri ::XML ::SyntaxError ) do
182+ context_node . parse ( "<div </div>" , options : ParseOptions . new )
183+ end
184+ end
185+
156186 def test_node_context_parsing_of_malformed_xml_fragment_uses_the_right_class_to_recover
157187 doc = XML . parse ( "<root><body><div></div></body></root>" )
158188 context_node = doc . at_css ( "div" )
0 commit comments