Sha256: f12b1ff9eb65d1cdfb1188dba699a37728dccc571e6959f9a58918c65911c001
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
require "libxml" require 'test/unit' class TC_XML_Node5 < Test::Unit::TestCase def setup() xp = XML::Parser.new() str = '<test><num>one</num><num>two</num><num>three</num></test>' assert_equal(str, xp.string = str) @doc = xp.parse assert_instance_of(XML::Document, @doc) @root = @doc.root @num1 = @root.child @num2 = @num1.next @num3 = @num2.next end def test_libxml_node_add_next_01 @num1.next = XML::Node.new('num', 'one-and-a-half') assert_equal '<test><num>one</num><num>one-and-a-half</num><num>two</num><num>three</num></test>', @root.to_s.gsub(/\n\s*/,'') end def test_libxml_node_add_next_02 @num2.next = XML::Node.new('num', 'two-and-a-half') assert_equal '<test><num>one</num><num>two</num><num>two-and-a-half</num><num>three</num></test>', @root.to_s.gsub(/\n\s*/,'') end def test_libxml_node_add_next_03 @num3.next = XML::Node.new('num', 'four') assert_equal '<test><num>one</num><num>two</num><num>three</num><num>four</num></test>', @root.to_s.gsub(/\n\s*/,'') end def test_libxml_node_add_prev_01 @num1.prev = XML::Node.new('num', 'half') assert_equal '<test><num>half</num><num>one</num><num>two</num><num>three</num></test>', @root.to_s.gsub(/\n\s*/,'') end def test_libxml_node_add_prev_02 @num2.prev = XML::Node.new('num', 'one-and-a-half') assert_equal '<test><num>one</num><num>one-and-a-half</num><num>two</num><num>three</num></test>', @root.to_s.gsub(/\n\s*/,'') end def test_libxml_node_add_prev_03 @num3.prev = XML::Node.new('num', 'two-and-a-half') assert_equal '<test><num>one</num><num>two</num><num>two-and-a-half</num><num>three</num></test>', @root.to_s.gsub(/\n\s*/,'') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
libxml-ruby-0.5.4 | test/tc_xml_node5.rb |
libxml-ruby-0.5.3 | test/tc_xml_node5.rb |