Sha256: 51b375c597884b8a994d6b298fcb19a22952d0dc015f63f17106af858936d591

Contents?: true

Size: 1.33 KB

Versions: 126

Compression:

Stored size: 1.33 KB

Contents

require "helper"

module Nokogiri
  module XML
    class TestParseOptions < Nokogiri::TestCase
      def test_new
        options = Nokogiri::XML::ParseOptions.new
        assert_equal 0, options.options
      end

      def test_to_i
        options = Nokogiri::XML::ParseOptions.new
        assert_equal 0, options.to_i
      end

      ParseOptions.constants.each do |constant|
        next if constant == 'STRICT'
        class_eval %{
          def test_predicate_#{constant.downcase}
            options = ParseOptions.new(ParseOptions::#{constant})
            assert options.#{constant.downcase}?

            assert ParseOptions.new.#{constant.downcase}.#{constant.downcase}?
          end
        }
      end

      def test_strict_noent
        options = ParseOptions.new.recover.noent
        assert !options.strict?
      end

      def test_new_with_argument
        options = Nokogiri::XML::ParseOptions.new 1 << 1
        assert_equal 1 << 1, options.options
      end

      def test_chaining
        options = Nokogiri::XML::ParseOptions.new.recover.noent
        assert options.recover?
        assert options.noent?
      end

      def test_inspect
        options = Nokogiri::XML::ParseOptions.new.recover.noent
        ins = options.inspect
        assert_match(/recover/, ins)
        assert_match(/noent/, ins)
      end
    end
  end
end

Version data entries

126 entries across 126 versions & 18 rubygems

Version Path
nokogiri-maglev--1.5.2 test/xml/test_parse_options.rb
nokogiri-maglev--1.5.3 test/xml/test_parse_options.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.2/test/xml/test_parse_options.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.2/test/xml/test_parse_options.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.2/test/xml/test_parse_options.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.2/test/xml/test_parse_options.rb
nokogiri-1.5.4.rc1 test/xml/test_parse_options.rb
nokogiri-1.5.4.rc1-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.5.4.rc1-java test/xml/test_parse_options.rb
nokogiri-1.5.4.rc1-x86-mswin32-60 test/xml/test_parse_options.rb
nokogiri-1.5.3-java test/xml/test_parse_options.rb
nokogiri-1.5.3-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.5.3-x86-mswin32-60 test/xml/test_parse_options.rb
nokogiri-1.5.3 test/xml/test_parse_options.rb
nokogiri-1.5.3.rc6-java test/xml/test_parse_options.rb
nokogiri-1.5.3.rc6-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.5.3.rc6-x86-mswin32-60 test/xml/test_parse_options.rb
nokogiri-1.5.3.rc6 test/xml/test_parse_options.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.2/test/xml/test_parse_options.rb
ftl-0.2.0 vendor/bundle/gems/nokogiri-1.5.2/test/xml/test_parse_options.rb