Sha256: 845c9cf33ff7439ae53deb5690572e85d2b0c5cf78252c9f66171cf8100c7912

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

# -*- coding: utf-8 -*-

require "helper"

module Nokogiri
  module XML
    module SAX
      class TestParserContext < Nokogiri::SAX::TestCase
        def test_replace_entities
          pc = ParserContext.new StringIO.new('<root />'), 'UTF-8'
          pc.replace_entities = false
          assert_equal false, pc.replace_entities

          pc.replace_entities = true
          assert_equal true, pc.replace_entities
        end

        def test_from_io
          assert_nothing_raised do
            ParserContext.new StringIO.new('fo'), 'UTF-8'
          end
        end

        def test_from_string
          assert_nothing_raised do
            ParserContext.new 'blah blah'
          end
        end

        def test_parse_with
          ctx = ParserContext.new 'blah'
          assert_raises ArgumentError do
            ctx.parse_with nil
          end
        end

        def test_parse_with_sax_parser
          assert_nothing_raised do
            xml = "<root />"
            ctx = ParserContext.new xml
            parser = Parser.new Doc.new
            ctx.parse_with parser
          end
        end

        def test_from_file
          assert_nothing_raised do
            ctx = ParserContext.file XML_FILE
            parser = Parser.new Doc.new
            ctx.parse_with parser
          end
        end

        def test_parse_with_returns_nil
          xml = "<root />"
          ctx = ParserContext.new xml
          parser = Parser.new Doc.new
          assert_nil ctx.parse_with parser
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
rubyjedi-nokogiri_java-1.4.0.20100513161003-java test/xml/sax/test_parser_context.rb
revo-nokogiri-1.4.1-java test/xml/sax/test_parser_context.rb
revo-nokogiri-1.4.0.3-java test/xml/sax/test_parser_context.rb
revo-nokogiri-1.4.0-java test/xml/sax/test_parser_context.rb
revo-nokogiri-1.4.0.20100202165440-java test/xml/sax/test_parser_context.rb