xml-smart 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -203,7 +203,7 @@ module XML
203
203
  @element.xpath_fast('*').length > 0 && @element.xpath_fast("string(text())") == '';
204
204
  end
205
205
 
206
- def path; @element.path; end
206
+ def path; @element.path[-1] != ']' ? @element.path + '[1]' : @element.path; end
207
207
 
208
208
  def ==(other)
209
209
  return false unless other
@@ -0,0 +1,30 @@
1
+ require 'time'
2
+
3
+ module Minitest
4
+ def self.plugin_performancereporter_init(options)
5
+ self.reporter << PerformanceReporter.new(options[:io], options)
6
+ end
7
+
8
+ class PerformanceReporter < StatisticsReporter
9
+ @@timings = []
10
+
11
+ def self.start_timing(name)
12
+ @@timings << [name,false,Time.now.to_f]
13
+ end
14
+
15
+ def self.end_timing
16
+ @@timings.last[1] = true
17
+ @@timings.last[2] = Time.now.to_f - @@timings.last[2]
18
+ end
19
+
20
+ def report
21
+ super
22
+ if @@timings.length > 0
23
+ puts "\nPERFORMANCE:"
24
+ @@timings.each do |tim|
25
+ puts " * #{tim[0]}: #{'%f' % tim[2]} seconds" if tim[1]
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
data/test/EXAMPLE.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <test xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xml:lang="de">
2
2
  <names>
3
- <name team="0" a="3">2013-08-30 01:18:22 +0200</name>
3
+ <name team="0" a="3">2014-04-17 21:10:14 +0200</name>
4
4
  <name team="1">Jürgen</name>
5
5
  <name team="1">Michel</name>
6
6
  <name team="1">Raphi</name>
data/test/concurrent.xml CHANGED
@@ -1,7 +1 @@
1
- <solutions>
2
- <solution matnr="9906264" name="mangler" secid="1" when="2013-08-30T01:18:17+02:00" assessment="16">
3
- <question block="1" question="2"/>
4
- <question block="2" question="4"/>
5
- <question block="3" question="6"/>
6
- </solution>
7
- </solutions>
1
+ <solutions><solution matnr="9906264" name="mangler" secid="1" assessment="16"><question block="1" question="2"/><question block="2" question="4"/><question block="3" question="6"/></solution></solutions>
data/test/smartrunner.rb CHANGED
@@ -1,30 +1,4 @@
1
1
  require 'rubygems'
2
- gem 'minitest', '=4.7.4'
2
+ $LOAD_PATH.push File.expand_path(File::dirname(__FILE__) + "/..")
3
+ gem "minitest"
3
4
  require 'minitest/autorun'
4
- require 'time'
5
-
6
- $timings = []
7
-
8
- def start_timing(name)
9
- $timings << [name,false,Time.now.to_f]
10
- end
11
-
12
- def end_timing
13
- $timings.last[1] = true
14
- $timings.last[2] = Time.now.to_f - $timings.last[2]
15
- end
16
-
17
- class MiniTest::Unit
18
- OLD_run_anything = instance_method(:_run_anything)
19
-
20
- def _run_anything type
21
- OLD_run_anything.bind(self).call(type)
22
- if $timings.length > 0
23
- puts
24
- puts "PERFORMANCE:"
25
- $timings.each do |tim|
26
- puts " * #{tim[0]}: #{'%f' % tim[2]} seconds" if tim[1]
27
- end
28
- end
29
- end
30
- end
data/test/tc_add.rb CHANGED
@@ -1,18 +1,18 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestAdd < MiniTest::Unit::TestCase
4
+ class TestAdd < MiniTest::Test
5
5
  def test_add
6
6
  nums = 50000
7
7
 
8
8
  # Watch the power
9
- start_timing "Replace (#{nums} times)"
9
+ Minitest::PerformanceReporter::start_timing "Replace (#{nums} times)"
10
10
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
11
11
  0.upto(nums) { |i|
12
12
  nodes = doc.find("/test/names/name[6]")
13
13
  nodes.first.parent.add("name", { "team" => "2" }, "Egon")
14
14
  }
15
- end_timing
15
+ Minitest::PerformanceReporter::end_timing
16
16
 
17
17
  assert(doc.find("/test/names/name").length == nums + 7)
18
18
  end
data/test/tc_basic.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestBasic < MiniTest::Unit::TestCase
4
+ class TestBasic < MiniTest::Test
5
5
  def test_criss_cross
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
  node = doc.root.find("/test/names").first
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestConcurrent < MiniTest::Unit::TestCase
4
+ class TestConcurrent < Minitest::Test
5
5
  def test_unformated
6
6
  # Watch the power
7
7
  nums = 1000
@@ -14,11 +14,11 @@ class TestConcurrent < MiniTest::Unit::TestCase
14
14
 
15
15
  result = ""
16
16
  p = []
17
- start_timing "Concurrent - unformatted (#{nums} times)"
17
+ Minitest::PerformanceReporter::start_timing "Concurrent - unformatted (#{nums} times)"
18
18
  0.upto(nums) do |i|
19
19
  p[i] = Thread.new do
20
20
  XML::Smart.modify(::File.dirname(__FILE__) + "/concurrent.xml","<solutions/>") do |xml|
21
- xml.save_unformated = true
21
+ xml.unformated = true
22
22
  res = xml.find("/solutions/solution[@matnr=\"#{e_matnr}\" or @secid=\"#{e_secid}\"]").delete_all! if exam
23
23
  node = xml.root.add("solution",{:matnr => e_matnr, :name => e_name, :secid => e_secid, :assessment => id})
24
24
  1.upto(3) do |qbi|
@@ -34,7 +34,7 @@ class TestConcurrent < MiniTest::Unit::TestCase
34
34
  p.each do |t|
35
35
  t.join
36
36
  end
37
- end_timing
37
+ Minitest::PerformanceReporter::end_timing
38
38
  end
39
39
 
40
40
  def test_formated
@@ -48,7 +48,7 @@ class TestConcurrent < MiniTest::Unit::TestCase
48
48
  exam = true
49
49
 
50
50
  p = []
51
- start_timing "Concurrent - formatted (#{nums} times)"
51
+ Minitest::PerformanceReporter::start_timing "Concurrent - formatted (#{nums} times)"
52
52
  0.upto(nums) do |i|
53
53
  p[i] = Thread.new do
54
54
  XML::Smart.modify(::File.dirname(__FILE__) + "/concurrent.xml","<solutions/>") do |xml|
@@ -65,6 +65,6 @@ class TestConcurrent < MiniTest::Unit::TestCase
65
65
  p.each do |t|
66
66
  t.join
67
67
  end
68
- end_timing
68
+ Minitest::PerformanceReporter::end_timing
69
69
  end
70
70
  end
data/test/tc_copy.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestCopy < MiniTest::Unit::TestCase
4
+ class TestCopy < Minitest::Test
5
5
  def test_copy
6
6
  # No closure, so changes are temporary
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
data/test/tc_create.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestCreate < MiniTest::Unit::TestCase
4
+ class TestCreate < Minitest::Test
5
5
  def test_create
6
6
  # When a string as second paramter is provided, then a empty
7
7
  # xml file is created if it not exists. A block has to be supplied
data/test/tc_delete.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
3
3
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
4
4
 
5
- class TestDelete < MiniTest::Unit::TestCase
5
+ class TestDelete < Minitest::Test
6
6
  def test_delete
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
8
8
 
@@ -2,7 +2,7 @@
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
3
3
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
4
4
 
5
- class TestMoveElements < MiniTest::Unit::TestCase
5
+ class TestMoveElements < Minitest::Test
6
6
  def test_move_elements
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
8
8
  node = doc.find("/test/names/name[@team='1']").first
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestNamespaceDefault < MiniTest::Unit::TestCase
4
+ class TestNamespaceDefault < Minitest::Test
5
5
  def test_namespace_default
6
6
  # No closure, so changes are temporary
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestNamespaceDetailes < MiniTest::Unit::TestCase
4
+ class TestNamespaceDetailes < Minitest::Test
5
5
  def test_namespace_detailed
6
6
  # No closure, so changes are temporary
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestNamespaceFind < MiniTest::Unit::TestCase
4
+ class TestNamespaceFind < Minitest::Test
5
5
  def test_namespace_find
6
6
  # No closure, so changes are temporary
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
data/test/tc_nested.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestNested < MiniTest::Unit::TestCase
4
+ class TestNested < Minitest::Test
5
5
  def test_nested
6
6
  nums = 5000
7
7
  soc = XML::Smart.string("<?xml version='1.0'?><root><node id='1'><text>I am a text</text></node><node id='2'/></root>")
8
8
  # Watch the power
9
- start_timing "Nested (#{nums} times)"
9
+ Minitest::PerformanceReporter::start_timing "Nested (#{nums} times)"
10
10
  1.upto(nums) { |i|
11
11
  # create a XML document and copy the elements for each node to a file
12
12
  soc.find("/root/node").each do |ele|
@@ -18,6 +18,6 @@ class TestNested < MiniTest::Unit::TestCase
18
18
  ts = soc.find("/root/node").first
19
19
  ts.add('text','Haller')
20
20
  }
21
- end_timing
21
+ Minitest::PerformanceReporter::end_timing
22
22
  end
23
23
  end
data/test/tc_pi.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestPi < MiniTest::Unit::TestCase
4
+ class TestPi < Minitest::Test
5
5
  def test_pi
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
  pi = doc.root.add('?tobias', 'dj')
data/test/tc_qname.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestQname < MiniTest::Unit::TestCase
4
+ class TestQname < Minitest::Test
5
5
  def test_qname
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
  doc.register_namespace("s","http://schemas.xmlsoap.org/wsdl/soap/")
data/test/tc_relaxng.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestRelaxng < MiniTest::Unit::TestCase
4
+ class TestRelaxng < Minitest::Test
5
5
  def test_relaxng
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.xml")
7
7
  doc.xinclude!
@@ -9,12 +9,12 @@ class TestRelaxng < MiniTest::Unit::TestCase
9
9
 
10
10
  nums = 10000
11
11
  # Watch the power
12
- start_timing "RelaxNG #validate_against (#{nums} times)"
12
+ Minitest::PerformanceReporter::start_timing "RelaxNG #validate_against (#{nums} times)"
13
13
  nums.times do
14
14
  doc.validate_against(xsd)
15
15
  end
16
16
  assert(doc.validate_against(xsd) == true)
17
- end_timing
17
+ Minitest::PerformanceReporter::end_timing
18
18
 
19
19
  doc.find('/hellos/hello[3]').each do |h|
20
20
  h.qname.name = 'test'
data/test/tc_root.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestBasic < MiniTest::Unit::TestCase
4
+ class TestBasic < Minitest::Test
5
5
  def test_root
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
 
@@ -1,11 +1,11 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestSetOrReplace < MiniTest::Unit::TestCase
4
+ class TestSetOrReplace < Minitest::Test
5
5
  def test_set_or_replace
6
6
  nums = 1000
7
7
 
8
- start_timing "#replace_by, #root= (#{nums} times)"
8
+ Minitest::PerformanceReporter::start_timing "#replace_by, #root= (#{nums} times)"
9
9
  1.upto(nums) { |i|
10
10
  # create a XML document and copy the elements for each node to a file
11
11
  soc = XML::Smart.string("<?xml version='1.0'?><root><node id='1'><text>I am a text</text></node><node id='2'/></root>")
@@ -25,7 +25,7 @@ class TestSetOrReplace < MiniTest::Unit::TestCase
25
25
  cdoc = XML::Smart.open(::File.dirname(__FILE__) + "/3.xml")
26
26
  cdoc.root = XML::Smart.string("<root><node id='1'><text>I am a text</text></node><node id='#{i}'/></root>").root
27
27
  }
28
- end_timing
28
+ Minitest::PerformanceReporter::end_timing
29
29
 
30
30
  soc = XML::Smart.string("<?xml version='1.0'?><root><node id='1'><text>I am a text</text></node><node id='2'/></root>")
31
31
  eles = soc.root.find("/root/node")
data/test/tc_sort.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
3
3
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
4
4
 
5
- class TestSort < MiniTest::Unit::TestCase
5
+ class TestSort < Minitest::Test
6
6
  def test_sort
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
8
8
  nodes = doc.find("//names/name[@team>0]").sort{|a,b| a.to_s <=> b.to_s}
data/test/tc_string.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
3
3
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
4
4
 
5
- class TestString < MiniTest::Unit::TestCase
5
+ class TestString < Minitest::Test
6
6
  def test_String
7
7
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
8
8
 
data/test/tc_todoc.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestToDoc < MiniTest::Unit::TestCase
4
+ class TestToDoc < Minitest::Test
5
5
  def test_todoc
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE-NS.xml")
7
7
  doc.root.children[0].add('soap:haller')
@@ -14,11 +14,11 @@ class TestToDoc < MiniTest::Unit::TestCase
14
14
  assert(doc.find("/d:test").first.to_doc.root.namespaces.length == 2)
15
15
 
16
16
  # Watch the power
17
- start_timing "#to_doc (#{nums} times)"
17
+ Minitest::PerformanceReporter::start_timing "#to_doc (#{nums} times)"
18
18
  nums.times do
19
19
  doc.find("/d:test/d:names/d:name[2]").first.to_doc
20
20
  end
21
- end_timing
21
+ Minitest::PerformanceReporter::end_timing
22
22
 
23
23
  assert(doc.find("/d:test/d:names/d:name[2]").first.to_doc.root.dump == '<name xmlns="http://example.org" team="1">J&#xFC;rgen</name>')
24
24
  end
data/test/tc_version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXSL < MiniTest::Unit::TestCase
4
+ class TestXSL < Minitest::Test
5
5
  def test_version
6
6
  assert XML::Smart::VERSION.is_a? String
7
7
  assert XML::Smart::VERSION =~ /\d+\.\d+\.\d+(\.\d+)?/
data/test/tc_write.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestWrite < MiniTest::Unit::TestCase
4
+ class TestWrite < Minitest::Test
5
5
  def test_write
6
6
  tim = Time.now
7
7
 
data/test/tc_xinclude.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXinclude < MiniTest::Unit::TestCase
4
+ class TestXinclude < Minitest::Test
5
5
  def test_xinclude
6
6
  nums = 10000
7
7
 
8
8
  # Watch the power
9
- start_timing "#xinclude! (#{nums} times)"
9
+ Minitest::PerformanceReporter::start_timing "#xinclude! (#{nums} times)"
10
10
  nums.times do
11
11
  doc = XML::Smart.open_unprotected(::File.dirname(__FILE__) + "/HELLO.xml")
12
12
  doc.xinclude!
13
13
  end
14
- end_timing
14
+ Minitest::PerformanceReporter::end_timing
15
15
 
16
16
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.xml")
17
17
  doc.xinclude!
data/test/tc_xmlschema.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXmlSchema < MiniTest::Unit::TestCase
4
+ class TestXmlSchema < Minitest::Test
5
5
  def test_xmlschema
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.xml")
7
7
  doc.xinclude!
@@ -9,12 +9,12 @@ class TestXmlSchema < MiniTest::Unit::TestCase
9
9
 
10
10
  nums = 500
11
11
  # Watch the power
12
- start_timing "XML Schema #validate_against (#{nums} times)"
12
+ Minitest::PerformanceReporter::start_timing "XML Schema #validate_against (#{nums} times)"
13
13
  nums.times do
14
14
  doc.validate_against(xsd)
15
15
  end
16
16
  assert(doc.validate_against(xsd) == true)
17
- end_timing
17
+ Minitest::PerformanceReporter::end_timing
18
18
 
19
19
  doc.find('/hellos/hello[3]').each do |h|
20
20
  h.qname.name = 'test'
data/test/tc_xpath.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXpath < MiniTest::Unit::TestCase
4
+ class TestXpath < Minitest::Test
5
5
  def test_xpath
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE-NS.xml")
7
7
  doc.register_namespace 'des', 'http://example.org'
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXpathAttrs < MiniTest::Unit::TestCase
4
+ class TestXpathAttrs < Minitest::Test
5
5
  def test_xpath_attrs
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
  node = doc.root.find("/test/names/name[2]/@team").first
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXpathFunctions < MiniTest::Unit::TestCase
4
+ class TestXpathFunctions < Minitest::Test
5
5
  def test_xpath_functions
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
  assert(doc.root.find("count(/test/names/name)") == 6.0)
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXpathRoot < MiniTest::Unit::TestCase
4
+ class TestXpathRoot < Minitest::Test
5
5
  def test_xpath_root
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/EXAMPLE.xml")
7
7
  nodes = doc.find("//*/text()")
data/test/tc_xsl.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart')
2
2
  require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb')
3
3
 
4
- class TestXSL < MiniTest::Unit::TestCase
4
+ class TestXSL < MiniTest::Test
5
5
  def test_xsl
6
6
  doc = XML::Smart.open(::File.dirname(__FILE__) + "/XSL_BASE.xml")
7
7
  style = XML::Smart.open(::File.dirname(__FILE__) + "/XSL_DOCUMENT.xml")
@@ -9,11 +9,11 @@ class TestXSL < MiniTest::Unit::TestCase
9
9
  nums = 1000
10
10
 
11
11
  # Watch the power
12
- start_timing "#transform_with (#{nums} times)"
12
+ Minitest::PerformanceReporter::start_timing "#transform_with (#{nums} times)"
13
13
  nums.times do
14
14
  doc.transform_with(style)
15
15
  end
16
- end_timing
16
+ Minitest::PerformanceReporter::end_timing
17
17
 
18
18
  assert(doc.root.to_s == XML::Smart.open(::File.dirname(__FILE__) + "/XSL_BASE.xml.test").root.to_s)
19
19
  end
data/xml-smart.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xml-smart"
3
- s.version = "0.3.8"
3
+ s.version = "0.3.9"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "An xml library that doesn't suck - since 2004."
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.files = Dir['{lib/**/*,example/**/*}'] + %w(COPYING Rakefile xml-smart.gemspec README.rdoc AUTHORS)
11
11
  s.require_path = 'lib'
12
12
  s.extra_rdoc_files = ['README.rdoc']
13
- s.test_files = Dir['test/tc_*.rb','test/*.xml','test/*.rng','test/*.xsd','test/*.test','test/smartrunner.rb']
13
+ s.test_files = Dir['test/tc_*.rb','test/*.xml','test/*.rng','test/*.xsd','test/smartrunner.rb','minitest/*']
14
14
 
15
15
  s.authors = ['Juergen eTM Mangler']
16
16
  s.email = 'juergen.mangler@gmail.com'
@@ -20,5 +20,5 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_runtime_dependency 'nokogiri'
22
22
  s.add_runtime_dependency 'term-ansicolor'
23
- s.add_runtime_dependency 'minitest', '=4.7.4'
23
+ s.add_runtime_dependency 'minitest', '>= 5.0.0'
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-smart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-19 00:00:00.000000000 Z
12
+ date: 2014-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -48,17 +48,17 @@ dependencies:
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - '='
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 4.7.4
53
+ version: 5.0.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - '='
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 4.7.4
61
+ version: 5.0.0
62
62
  description: An xml library that doesn't suck (since 2004). Based on Nokogiri since
63
63
  2012. For more info check out the Documentation link below.
64
64
  email: juergen.mangler@gmail.com
@@ -67,19 +67,19 @@ extensions: []
67
67
  extra_rdoc_files:
68
68
  - README.rdoc
69
69
  files:
70
- - lib/xml/smart_qname.rb
71
- - lib/xml/smart_domnamespaceset.rb
72
- - lib/xml/smart_dom.rb
73
- - lib/xml/smart_domnamespace.rb
74
- - lib/xml/smart_processinginstruction.rb
75
- - lib/xml/smart_domtext.rb
70
+ - lib/xml/smart_domattributeset.rb
71
+ - lib/xml/smart_domattribute.rb
76
72
  - lib/xml/smart_domother.rb
77
- - lib/xml/XSDtoRNG.xsl
78
- - lib/xml/smart.rb
79
73
  - lib/xml/smart_domelement.rb
74
+ - lib/xml/smart_domtext.rb
75
+ - lib/xml/smart_domnamespace.rb
80
76
  - lib/xml/smart_domnodeset.rb
81
- - lib/xml/smart_domattributeset.rb
82
- - lib/xml/smart_domattribute.rb
77
+ - lib/xml/smart.rb
78
+ - lib/xml/XSDtoRNG.xsl
79
+ - lib/xml/smart_dom.rb
80
+ - lib/xml/smart_domnamespaceset.rb
81
+ - lib/xml/smart_qname.rb
82
+ - lib/xml/smart_processinginstruction.rb
83
83
  - example/EXAMPLE.xml
84
84
  - example/xpath_visual.rb
85
85
  - COPYING
@@ -87,53 +87,51 @@ files:
87
87
  - xml-smart.gemspec
88
88
  - README.rdoc
89
89
  - AUTHORS
90
- - test/tc_nested.rb
91
- - test/tc_namespace_detailed.rb
92
- - test/tc_xpath.rb
93
- - test/tc_basic.rb
94
- - test/tc_xinclude.rb
95
- - test/tc_sort.rb
96
- - test/tc_copy.rb
97
- - test/tc_xsl.rb
98
- - test/tc_root.rb
99
90
  - test/tc_xpath_attrs.rb
100
- - test/tc_xmlschema.rb
101
91
  - test/tc_pi.rb
102
- - test/tc_namespace_find.rb
103
92
  - test/tc_add.rb
93
+ - test/tc_relaxng.rb
104
94
  - test/tc_delete.rb
95
+ - test/tc_copy.rb
105
96
  - test/tc_string.rb
106
- - test/tc_qname.rb
97
+ - test/tc_sort.rb
98
+ - test/tc_create.rb
99
+ - test/tc_namespace_find.rb
100
+ - test/tc_xsl.rb
101
+ - test/tc_nested.rb
102
+ - test/tc_todoc.rb
103
+ - test/tc_move_elements.rb
107
104
  - test/tc_namespace_default.rb
108
- - test/tc_set_or_replace.rb
105
+ - test/tc_root.rb
109
106
  - test/tc_xpath_functions.rb
110
- - test/tc_move_elements.rb
111
- - test/tc_relaxng.rb
112
- - test/tc_version.rb
107
+ - test/tc_set_or_replace.rb
113
108
  - test/tc_concurrent.rb
114
- - test/tc_xpath_root.rb
115
- - test/tc_todoc.rb
109
+ - test/tc_xmlschema.rb
110
+ - test/tc_qname.rb
116
111
  - test/tc_write.rb
117
- - test/tc_create.rb
118
- - test/3.xml
112
+ - test/tc_xinclude.rb
113
+ - test/tc_basic.rb
114
+ - test/tc_xpath.rb
115
+ - test/tc_version.rb
116
+ - test/tc_xpath_root.rb
117
+ - test/tc_namespace_detailed.rb
118
+ - test/XSL_BASE.xml
119
+ - test/EXAMPLE.tmp.xml
120
+ - test/1.xml
119
121
  - test/2.xml
120
- - test/EXAMPLE.xml
121
122
  - test/EXAMPLE-NSE.xml
122
- - test/EXAMPLE.tmp.xml
123
123
  - test/XSL_DOCUMENT.xml
124
+ - test/3.xml
124
125
  - test/EXAMPLE.str.xml
125
- - test/concurrent.xml
126
- - test/1.xml
127
126
  - test/HELLO-MORE.xml
128
- - test/XSL_BASE.xml
127
+ - test/EXAMPLE.xml
128
+ - test/concurrent.xml
129
129
  - test/EXAMPLE-NS.xml
130
130
  - test/HELLO.xml
131
131
  - test/HELLO.rng
132
132
  - test/HELLO.xsd
133
- - test/EXAMPLE.str.xml.test
134
- - test/XSL_BASE.xml.test
135
- - test/EXAMPLE.tmp.xml.test
136
133
  - test/smartrunner.rb
134
+ - minitest/performancereporter_plugin.rb
137
135
  homepage: http://www.wst.univie.ac.at/~mangler/xml-smart/
138
136
  licenses:
139
137
  - LGPL-3
@@ -160,50 +158,48 @@ signing_key:
160
158
  specification_version: 3
161
159
  summary: An xml library that doesn't suck - since 2004.
162
160
  test_files:
163
- - test/tc_nested.rb
164
- - test/tc_namespace_detailed.rb
165
- - test/tc_xpath.rb
166
- - test/tc_basic.rb
167
- - test/tc_xinclude.rb
168
- - test/tc_sort.rb
169
- - test/tc_copy.rb
170
- - test/tc_xsl.rb
171
- - test/tc_root.rb
172
161
  - test/tc_xpath_attrs.rb
173
- - test/tc_xmlschema.rb
174
162
  - test/tc_pi.rb
175
- - test/tc_namespace_find.rb
176
163
  - test/tc_add.rb
164
+ - test/tc_relaxng.rb
177
165
  - test/tc_delete.rb
166
+ - test/tc_copy.rb
178
167
  - test/tc_string.rb
179
- - test/tc_qname.rb
168
+ - test/tc_sort.rb
169
+ - test/tc_create.rb
170
+ - test/tc_namespace_find.rb
171
+ - test/tc_xsl.rb
172
+ - test/tc_nested.rb
173
+ - test/tc_todoc.rb
174
+ - test/tc_move_elements.rb
180
175
  - test/tc_namespace_default.rb
181
- - test/tc_set_or_replace.rb
176
+ - test/tc_root.rb
182
177
  - test/tc_xpath_functions.rb
183
- - test/tc_move_elements.rb
184
- - test/tc_relaxng.rb
185
- - test/tc_version.rb
178
+ - test/tc_set_or_replace.rb
186
179
  - test/tc_concurrent.rb
187
- - test/tc_xpath_root.rb
188
- - test/tc_todoc.rb
180
+ - test/tc_xmlschema.rb
181
+ - test/tc_qname.rb
189
182
  - test/tc_write.rb
190
- - test/tc_create.rb
191
- - test/3.xml
183
+ - test/tc_xinclude.rb
184
+ - test/tc_basic.rb
185
+ - test/tc_xpath.rb
186
+ - test/tc_version.rb
187
+ - test/tc_xpath_root.rb
188
+ - test/tc_namespace_detailed.rb
189
+ - test/XSL_BASE.xml
190
+ - test/EXAMPLE.tmp.xml
191
+ - test/1.xml
192
192
  - test/2.xml
193
- - test/EXAMPLE.xml
194
193
  - test/EXAMPLE-NSE.xml
195
- - test/EXAMPLE.tmp.xml
196
194
  - test/XSL_DOCUMENT.xml
195
+ - test/3.xml
197
196
  - test/EXAMPLE.str.xml
198
- - test/concurrent.xml
199
- - test/1.xml
200
197
  - test/HELLO-MORE.xml
201
- - test/XSL_BASE.xml
198
+ - test/EXAMPLE.xml
199
+ - test/concurrent.xml
202
200
  - test/EXAMPLE-NS.xml
203
201
  - test/HELLO.xml
204
202
  - test/HELLO.rng
205
203
  - test/HELLO.xsd
206
- - test/EXAMPLE.str.xml.test
207
- - test/XSL_BASE.xml.test
208
- - test/EXAMPLE.tmp.xml.test
209
204
  - test/smartrunner.rb
205
+ - minitest/performancereporter_plugin.rb
@@ -1,6 +0,0 @@
1
- <contributors>
2
- <guy id="1" nick="eTM">Jürgen</guy>
3
- <guy id="2" nick="chris2">Christian</guy>
4
- <guy id="3">Emanuel</guy>
5
- <guy id="4">41</guy>
6
- </contributors>
@@ -1,4 +0,0 @@
1
- <elements>
2
- <element>Thread 1</element>
3
- <element>Thread 2</element>
4
- </elements>
@@ -1,16 +0,0 @@
1
- <doc>
2
- <title>Document Title</title>
3
- <chapter>
4
- <title>Chapter Title</title>
5
- <section>
6
- <title>Section Title</title>
7
- <para>This is a test.</para>
8
- <note>This is a note.</note>
9
- </section>
10
- <section>
11
- <title>Another Section Title</title>
12
- <para>This is <emph>another</emph> test.</para>
13
- <note>This is another note.</note>
14
- </section>
15
- </chapter>
16
- </doc>