Sha256: d91a0378c37ac18c6732e7e7a8fe984bfe91f4cf7b501123f7985dc678688a38

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 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
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
superfeedr-nokogiri-1.4.0.20091116183308 test/xml/sax/test_parser_context.rb
caring-nokogiri-1.4.1.pre1 test/xml/sax/test_parser_context.rb
nokogiri-1.4.0-java test/xml/sax/test_parser_context.rb
nokogiri-1.4.0-x86-mswin32 test/xml/sax/test_parser_context.rb
nokogiri-1.4.0-x86-mingw32 test/xml/sax/test_parser_context.rb
nokogiri-1.4.0 test/xml/sax/test_parser_context.rb