@@ -153,6 +153,35 @@ 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+ def test_node_context_parsing_of_malformed_xml_fragment_without_recover_is_not_corrected_keyword
176+ skip ( "libxml2 2.14.0 no longer raises this error" ) if Nokogiri . uses_libxml? ( ">= 2.14.0" )
177+
178+ doc = XML . parse ( "<root><body><div></div></body></roo" )
179+ context_node = doc . at_css ( "div" )
180+ assert_raises ( Nokogiri ::XML ::SyntaxError ) do
181+ context_node . parse ( "<div </div>" , options : ParseOptions . new )
182+ end
183+ end
184+
156185 def test_node_context_parsing_of_malformed_xml_fragment_uses_the_right_class_to_recover
157186 doc = XML . parse ( "<root><body><div></div></body></root>" )
158187 context_node = doc . at_css ( "div" )
0 commit comments