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
libxml-ruby-2.2.2 test/tc_node_copy.rb
libxml-ruby-2.2.1-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.2.1 test/tc_node_copy.rb
libxml-ruby-2.2.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.2.0 test/tc_node_copy.rb
libxml-ruby-2.1.2-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.1.2 test/tc_node_copy.rb
libxml-ruby-2.1.1-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.1.1 test/tc_node_copy.rb
libxml-ruby-2.1.0-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.1.0 test/tc_node_copy.rb
libxml-ruby-2.0.9-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.0.9 test/tc_node_copy.rb
libxml-ruby-2.0.6-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.0.6 test/tc_node_copy.rb
libxml-ruby-2.0.5-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.0.5 test/tc_node_copy.rb
libxml-ruby-2.0.4-x86-mingw32 test/tc_node_copy.rb
libxml-ruby-2.0.4 test/tc_node_copy.rb
libxml-ruby-2.0.3-x86-mingw32 test/tc_node_copy.rb