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
nokogiri-1.4.1-x86-mswin32 test/ffi/test_document.rb
nokogiri-1.4.1-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.1-java test/ffi/test_document.rb
nokogiri-1.4.1 test/ffi/test_document.rb
superfeedr-nokogiri-1.4.0.20091116183308 test/ffi/test_document.rb
caring-nokogiri-1.4.1.pre1 test/ffi/test_document.rb
nokogiri-1.4.0-java test/ffi/test_document.rb
nokogiri-1.4.0-x86-mswin32 test/ffi/test_document.rb
nokogiri-1.4.0-x86-mingw32 test/ffi/test_document.rb
nokogiri-1.4.0 test/ffi/test_document.rb