require "helper"
module Nokogiri
module XML
module SAX
class TestPushParser < Nokogiri::SAX::TestCase
def setup
super
@parser = XML::SAX::PushParser.new(Doc.new)
end
def test_exception
assert_raises(SyntaxError) do
@parser << "
Paragraph 1
eoxml assert ! @parser.document.end_document_called @parser.finish assert @parser.document.end_document_called end def test_start_element @parser.<<(<<-eoxml)eoxml assert_equal [["p", ["id", "asdfasdf"]]], @parser.document.start_elements @parser.<<(<<-eoxml) Paragraph 1
eoxml assert_equal [' This is a comment '], @parser.document.comments @parser.finish end def test_start_element_ns @parser.<<(<<-eoxml)eoxml @parser.<<(<<-eoxml) Paragraph 1
eoxml assert_equal [' This is a comment '], @parser.document.comments @parser.finish end def test_chevron @parser.<<(<<-eoxml)Paragraph 1
eoxml @parser.finish assert_equal [' This is a comment '], @parser.document.comments end end end end end