diff --git a/test/html/sax/test_parser.rb b/test/html/sax/test_parser.rb
index 420ba144339..fcd924d0ea8 100644
--- a/test/html/sax/test_parser.rb
+++ b/test/html/sax/test_parser.rb
@@ -132,6 +132,34 @@ def test_parser_attributes
], @parser.document.start_elements
end
+ HTML_WITH_BR_TAG = <<-EOF
+
+
+
+
+ hello
+
+
+
+
+ hello again
+
+
+
+ EOF
+
+ def test_parsing_dom_error_from_string
+ @parser.parse(HTML_WITH_BR_TAG)
+ assert_equal 6, @parser.document.start_elements.length
+ end
+
+ def test_parsing_dom_error_from_io
+ @parser.parse(StringIO.new(HTML_WITH_BR_TAG))
+
+ assert_equal 6, @parser.document.start_elements.length
+ end
+
+
def test_empty_processing_instruction
@parser.parse_memory("this will segfault")
end