Sha256: b9bac19e8d54ea4130a504b8e933726d7e83ea16b004b3f68b114bdb1c3a7010

Contents?: true

Size: 1.39 KB

Versions: 19

Compression:

Stored size: 1.39 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', "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

19 entries across 19 versions & 2 rubygems

Version Path
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/xml/test_parse_options.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/xml/test_parse_options.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/xml/test_parse_options.rb
nokogiri-1.3.3-x86-mswin32 test/xml/test_parse_options.rb
nokogiri-1.3.3-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.3.3-java test/xml/test_parse_options.rb
nokogiri-1.3.2-x86-mswin32 test/xml/test_parse_options.rb
nokogiri-1.3.2-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.3.2-java test/xml/test_parse_options.rb
nokogiri-1.3.0-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.3.2 test/xml/test_parse_options.rb
nokogiri-1.3.3 test/xml/test_parse_options.rb
nokogiri-1.3.0-java test/xml/test_parse_options.rb
nokogiri-1.3.1-x86-mingw32 test/xml/test_parse_options.rb
nokogiri-1.3.1-java test/xml/test_parse_options.rb
nokogiri-1.3.0-x86-mswin32 test/xml/test_parse_options.rb
nokogiri-1.3.0 test/xml/test_parse_options.rb
nokogiri-1.3.1-x86-mswin32 test/xml/test_parse_options.rb
nokogiri-1.3.1 test/xml/test_parse_options.rb