Sha256: c4a8dc76bc2c697076434c7fb2d82b5639293f381f679b67051d8ecff9be5fb7

Contents?: true

Size: 878 Bytes

Versions: 22

Compression:

Stored size: 878 Bytes

Contents

require 'xml'
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.child_add(c)
    end
    assert @div1.to_s =~ /foo/
  end

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

end # TC_XML_Node_Copy

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
libxml-ruby-r19mingw-1.1.4 test/tc_node_copy.rb
libxml-ruby-1.1.4 test/tc_node_copy.rb
libxml-ruby-1.1.4-x86-mswin32-60 test/tc_node_copy.rb
coupa-libxml-ruby-1.1.4 test/tc_node_copy.rb
libxml-ruby-0.9.6-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-0.9.6 test/tc_node_copy.rb
libxml-ruby-0.9.7 test/tc_node_copy.rb
libxml-ruby-0.9.7-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-1.0.0-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-1.1.0-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-0.9.9 test/tc_node_copy.rb
libxml-ruby-0.9.8 test/tc_node_copy.rb
libxml-ruby-0.9.8-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-0.9.9-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-1.0.0 test/tc_node_copy.rb
libxml-ruby-1.1.0 test/tc_node_copy.rb
libxml-ruby-1.1.3 test/tc_node_copy.rb
libxml-ruby-1.1.3-x86-mswin32-60 test/tc_node_copy.rb
libxml-ruby-1.1.2 test/tc_node_copy.rb
libxml-ruby-1.1.1-x86-mswin32-60 test/tc_node_copy.rb