Sha256: 9c3aa5f49127d2b6eeae4b7a564084af081e17a99ebfe72fa6922868ced0f570

Contents?: true

Size: 1009 Bytes

Versions: 50

Compression:

Stored size: 1009 Bytes

Contents

require "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

50 entries across 50 versions & 9 rubygems

Version Path
domo-0.0.4 vendor/bundle/ruby/1.9.1/gems/nokogiri-1.4.4/test/ffi/test_document.rb
nokogiri-1.4.7-java test/ffi/test_document.rb
nokogiri-1.4.7-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.7-x86-mswin32-60 test/ffi/test_document.rb
nokogiri-1.4.7 test/ffi/test_document.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/nokogiri-1.4.6/test/ffi/test_document.rb
nokogiri-1.4.6 test/ffi/test_document.rb
nokogiri-1.4.6-java test/ffi/test_document.rb
nokogiri-1.4.6-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.6-x86-mswin32-60 test/ffi/test_document.rb
nokogiri-1.4.5-java test/ffi/test_document.rb
nokogiri-1.4.5 test/ffi/test_document.rb
nokogiri-1.4.5-x86-mswin32-60 test/ffi/test_document.rb
nokogiri-1.4.5-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.4.2-java test/ffi/test_document.rb
nokogiri-1.4.4.1-x86-mswin32 test/ffi/test_document.rb
nokogiri-1.4.4.1-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.4-x86-mswin32 test/ffi/test_document.rb
nokogiri-1.4.4-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.4-java test/ffi/test_document.rb