Sha256: 6ec048b9c1165b25dee6d817f32bab145501035007b69e374304ba9287ab7a1f

Contents?: true

Size: 804 Bytes

Versions: 13

Compression:

Stored size: 804 Bytes

Contents

require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')

class TestNested < Minitest::Test
  def test_nested
    nums  = 5000
    soc = XML::Smart.string("<?xml version='1.0'?><root><node id='1'><text>I am a text</text></node><node id='2'/></root>")
    # Watch the power
    Minitest::PerformanceReporter::start_timing "Nested (#{nums} times)"
    1.upto(nums) { |i|
      # create a XML document and copy the elements for each node to a file
      soc.find("/root/node").each do |ele|
        ts = ele.find('text')
        if ts.any?
          ts.first.to_doc
        end
      end
      ts = soc.find("/root/node").first
      ts.add('text','Haller')
    }
    Minitest::PerformanceReporter::end_timing
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
xml-smart-0.5.3 test/tc_nested.rb
xml-smart-0.5.2 test/tc_nested.rb
xml-smart-0.5.1 test/tc_nested.rb
xml-smart-0.5.0 test/tc_nested.rb
xml-smart-0.4.4 test/tc_nested.rb
xml-smart-0.4.3 test/tc_nested.rb
xml-smart-0.4.2 test/tc_nested.rb
xml-smart-0.4.1 test/tc_nested.rb
xml-smart-0.4.0 test/tc_nested.rb
xml-smart-0.3.22 test/tc_nested.rb
xml-smart-0.3.21 test/tc_nested.rb
xml-smart-0.3.20 test/tc_nested.rb
xml-smart-0.3.19 test/tc_nested.rb