Sha256: 0aa4c46240e3a53c34ec445fdceb0f145ea36026515a82576c5314e9d39fce5b

Contents?: true

Size: 868 Bytes

Versions: 26

Compression:

Stored size: 868 Bytes

Contents

# encoding: UTF-8

require_relative './test_helper'


class NodeCommentTest < Minitest::Test
  def setup
    xp = LibXML::XML::Parser.string('<root></root>')
    @doc = xp.parse
    assert_instance_of(LibXML::XML::Document, @doc)
    @root = @doc.root
  end

  def test_libxml_node_add_comment_01
    @root << LibXML::XML::Node.new_comment('mycomment')
    assert_equal '<root><!--mycomment--></root>',
      @root.to_s.gsub(/\n\s*/,'')
  end

  def test_libxml_node_add_comment_02
    @root << LibXML::XML::Node.new_comment('mycomment')
    assert_equal 'comment',
    @root.child.node_type_name
  end

  def test_libxml_node_add_comment_03
    @root << el = LibXML::XML::Node.new_comment('mycomment')
    el << "_this_is_added"
    assert_equal '<root><!--mycomment_this_is_added--></root>',
    @root.to_s.gsub(/\n\s*/,'')
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
libxml-ruby-3.2.2-x64-mingw-ucrt test/test_node_comment.rb
libxml-ruby-3.2.2 test/test_node_comment.rb
libxml-ruby-3.2.1-x64-mingw32 test/test_node_comment.rb
libxml-ruby-3.2.1 test/test_node_comment.rb
libxml-ruby-3.2.0 test/test_node_comment.rb
libxml-ruby-3.2.0-x64-mingw32 test/test_node_comment.rb