Sha256: b89f2226b5d4a5f1b6301607b86b4fa7e5552a74d2a322523dfffc8a2fe875cf

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "..", "helper"))

if defined?(Nokogiri::LibXML)

  class FFI::TestDocument < Nokogiri::TestCase

    def test_ruby_doc_reflection
      doc = Nokogiri::XML("<root><foo>foo</foo></root>")
      assert_equal doc, doc.cstruct.ruby_doc
    end

    def test_ruby_doc_setter
      doc = Nokogiri::XML("<root><foo>foo</foo></root>")
      foo = "foobar"
      doc.cstruct.ruby_doc = foo
      assert_equal foo, doc.cstruct.ruby_doc
    end

    def test_unlinked_nodes
      doc = Nokogiri::XML("<root><foo>foo</foo></root>")
      assert_instance_of Nokogiri::LibXML::XmlNodeSetCast, doc.cstruct.unlinked_nodes
    end

    def test_unlinked_nodes_contains_unlinked_nodes
      doc = Nokogiri::XML("<root><foo>foo</foo></root>")
      node = doc.xpath('//foo').first
      assert_equal 0, doc.cstruct.unlinked_nodes[:nodeNr]
      node.unlink
      assert_equal 1, doc.cstruct.unlinked_nodes[:nodeNr]
      assert_equal node.cstruct.pointer, doc.cstruct.unlinked_nodes[:nodeTab].get_pointer(0)
    end

  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/ffi/test_document.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/ffi/test_document.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/nokogiri-1.3.3/test/ffi/test_document.rb
nokogiri-1.3.3-x86-mswin32 test/ffi/test_document.rb
nokogiri-1.3.3-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.3.3-java test/ffi/test_document.rb
nokogiri-1.3.3 test/ffi/test_document.rb