Sha256: 0dc6893765e6b3ab6a6cf4a90c831344c233eec958c60cf0010ceea9e5074bef

Contents?: true

Size: 933 Bytes

Versions: 45

Compression:

Stored size: 933 Bytes

Contents

# encoding: UTF-8

require './test_helper'
require 'test/unit'

# see mailing list archive
# [libxml-devel] Segmentation fault when add the cloned/copied node
# 2007/11/27 20:51

class TestNodeCopy < Test::Unit::TestCase
  def setup
    str = <<-STR
      <html><body>
        <div class="textarea" id="t1" style="STATIC">foo</div>
        <div class="textarea" id="t2" style="STATIC">bar</div>
      </body></html>
    STR

    doc = XML::Parser.string(str).parse

    xpath = "//div"
    @div1 = doc.find(xpath).to_a[0]
    @div2 = doc.find(xpath).to_a[1]
  end

  def test_libxml_node_copy_not_segv
    @div2.each do |child|
      c = child.copy(false)
      @div1 << c
    end
    assert @div1.to_s =~ /foo/
  end

  def test_libxml_node_clone_not_segv
    @div2.each do |child|
      c = child.clone
      @div1 << c
    end
    assert @div1.to_s =~ /foo/
  end

end # TC_XML_Node_Copy

Version data entries

45 entries across 45 versions & 2 rubygems

Version Path
smile-xml-1.0.5-java src/test/ruby/tc_node_copy.rb
smile-xml-1.0.4-java src/test/ruby/tc_node_copy.rb
libxml-ruby-2.8.0 test/tc_node_copy.rb
smile-xml-1.0.3-java src/test/ruby/tc_node_copy.rb
libxml-ruby-2.7.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.7.0 test/tc_node_copy.rb
smile-xml-1.0.3-jruby src/test/ruby/tc_node_copy.rb
libxml-ruby-2.6.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.6.0 test/tc_node_copy.rb
libxml-ruby-2.5.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.5.0 test/tc_node_copy.rb
libxml-ruby-2.4.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.4.0 test/tc_node_copy.rb
smile-xml-1.0.2-jruby src/test/ruby/tc_node_copy.rb
libxml-ruby-2.3.3-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.3.3 test/tc_node_copy.rb
libxml-ruby-2.3.2 test/tc_node_copy.rb
libxml-ruby-2.3.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.3.0 test/tc_node_copy.rb
libxml-ruby-2.2.2-x86-mingw32 test/tc_node_copy.rb