libxml-ruby 2.7.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +6 -14
  2. data/HISTORY +33 -11
  3. data/README.rdoc +7 -7
  4. data/Rakefile +80 -77
  5. data/ext/libxml/extconf.h +4 -5
  6. data/ext/libxml/extconf.rb +57 -118
  7. data/ext/libxml/libxml.c +4 -0
  8. data/ext/libxml/ruby_xml.c +977 -893
  9. data/ext/libxml/ruby_xml.h +20 -10
  10. data/ext/libxml/ruby_xml_attr.c +333 -333
  11. data/ext/libxml/ruby_xml_attr_decl.c +2 -2
  12. data/ext/libxml/ruby_xml_cbg.c +85 -85
  13. data/ext/libxml/ruby_xml_document.c +1133 -1147
  14. data/ext/libxml/ruby_xml_dtd.c +261 -268
  15. data/ext/libxml/ruby_xml_encoding.c +262 -260
  16. data/ext/libxml/ruby_xml_encoding.h +19 -19
  17. data/ext/libxml/ruby_xml_html_parser_context.c +337 -338
  18. data/ext/libxml/ruby_xml_input_cbg.c +191 -191
  19. data/ext/libxml/ruby_xml_io.c +52 -50
  20. data/ext/libxml/ruby_xml_namespace.c +2 -2
  21. data/ext/libxml/ruby_xml_node.c +1446 -1452
  22. data/ext/libxml/ruby_xml_parser_context.c +999 -1001
  23. data/ext/libxml/ruby_xml_reader.c +1226 -1228
  24. data/ext/libxml/ruby_xml_relaxng.c +110 -111
  25. data/ext/libxml/ruby_xml_sax2_handler.c +326 -328
  26. data/ext/libxml/ruby_xml_schema.c +300 -301
  27. data/ext/libxml/ruby_xml_version.h +3 -3
  28. data/ext/libxml/ruby_xml_writer.c +34 -16
  29. data/ext/libxml/ruby_xml_xpath.c +188 -187
  30. data/ext/libxml/ruby_xml_xpath_context.c +360 -361
  31. data/ext/libxml/ruby_xml_xpath_object.c +335 -335
  32. data/libxml-ruby.gemspec +47 -44
  33. data/test/tc_attr.rb +5 -7
  34. data/test/tc_attr_decl.rb +5 -6
  35. data/test/tc_attributes.rb +1 -2
  36. data/test/tc_canonicalize.rb +1 -2
  37. data/test/tc_deprecated_require.rb +1 -2
  38. data/test/tc_document.rb +4 -5
  39. data/test/tc_document_write.rb +2 -3
  40. data/test/tc_dtd.rb +4 -5
  41. data/test/tc_encoding.rb +126 -126
  42. data/test/tc_encoding_sax.rb +4 -3
  43. data/test/tc_error.rb +14 -15
  44. data/test/tc_html_parser.rb +15 -7
  45. data/test/tc_html_parser_context.rb +1 -2
  46. data/test/tc_namespace.rb +2 -3
  47. data/test/tc_namespaces.rb +5 -6
  48. data/test/tc_node.rb +2 -3
  49. data/test/tc_node_cdata.rb +2 -3
  50. data/test/tc_node_comment.rb +1 -2
  51. data/test/tc_node_copy.rb +1 -2
  52. data/test/tc_node_edit.rb +5 -7
  53. data/test/tc_node_pi.rb +1 -2
  54. data/test/tc_node_text.rb +2 -3
  55. data/test/tc_node_write.rb +2 -3
  56. data/test/tc_node_xlink.rb +1 -2
  57. data/test/tc_parser.rb +18 -24
  58. data/test/tc_parser_context.rb +6 -7
  59. data/test/tc_properties.rb +1 -2
  60. data/test/tc_reader.rb +9 -10
  61. data/test/tc_relaxng.rb +4 -5
  62. data/test/tc_sax_parser.rb +9 -10
  63. data/test/tc_schema.rb +4 -5
  64. data/test/tc_traversal.rb +1 -2
  65. data/test/tc_writer.rb +1 -2
  66. data/test/tc_xinclude.rb +1 -2
  67. data/test/tc_xml.rb +1 -2
  68. data/test/tc_xpath.rb +8 -9
  69. data/test/tc_xpath_context.rb +3 -4
  70. data/test/tc_xpath_expression.rb +3 -4
  71. data/test/tc_xpointer.rb +1 -3
  72. data/test/test_helper.rb +3 -1
  73. data/test/test_suite.rb +0 -1
  74. metadata +90 -72
  75. data/test/etc_doc_to_s.rb +0 -21
  76. data/test/ets_doc_file.rb +0 -17
  77. data/test/ets_doc_to_s.rb +0 -23
  78. data/test/ets_gpx.rb +0 -28
  79. data/test/ets_node_gc.rb +0 -23
  80. data/test/ets_test.xml +0 -2
  81. data/test/ets_tsr.rb +0 -11
  82. data/test/model/kml_sample.xml +0 -915
  83. data/test/remove_test.rb +0 -9
  84. data/test/tc_gc.rb +0 -86
  85. data/test/tc_parser.rb.orig +0 -384
data/test/tc_reader.rb CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  require './test_helper'
4
4
  require 'stringio'
5
- require 'test/unit'
6
5
 
7
- class TestReader < Test::Unit::TestCase
6
+ class TestReader < Minitest::Test
8
7
  XML_FILE = File.join(File.dirname(__FILE__), 'model/atom.xml')
9
8
 
10
9
  def verify_simple(reader)
@@ -61,7 +60,7 @@ class TestReader < Test::Unit::TestCase
61
60
  end
62
61
 
63
62
  def test_invalid_file
64
- assert_raise(XML::Error) do
63
+ assert_raises(XML::Error) do
65
64
  XML::Reader.file('/does/not/exist')
66
65
  end
67
66
  end
@@ -98,7 +97,7 @@ class TestReader < Test::Unit::TestCase
98
97
  def test_error
99
98
  reader = XML::Reader.string('<foo blah')
100
99
 
101
- error = assert_raise(XML::Error) do
100
+ error = assert_raises(XML::Error) do
102
101
  reader.read
103
102
  end
104
103
  assert_equal("Fatal error: Couldn't find end of Start Tag foo at :1.", error.to_s)
@@ -111,7 +110,7 @@ class TestReader < Test::Unit::TestCase
111
110
  called = true
112
111
  end
113
112
 
114
- assert_raise(XML::Error) do
113
+ assert_raises(XML::Error) do
115
114
  reader.read
116
115
  end
117
116
 
@@ -126,7 +125,7 @@ class TestReader < Test::Unit::TestCase
126
125
  end
127
126
  reader.reset_error_handler
128
127
 
129
- assert_raise(XML::Error) do
128
+ assert_raises(XML::Error) do
130
129
  reader.read
131
130
  end
132
131
 
@@ -224,7 +223,7 @@ class TestReader < Test::Unit::TestCase
224
223
  node = reader.expand
225
224
 
226
225
  # Try to access the document
227
- assert_not_nil(node.doc)
226
+ refute_nil(node.doc)
228
227
  end
229
228
 
230
229
  def test_expand_find
@@ -246,7 +245,7 @@ class TestReader < Test::Unit::TestCase
246
245
  reader = XML::Reader.file(XML_FILE)
247
246
 
248
247
  # Expand a node before one has been read
249
- error = assert_raise(RuntimeError) do
248
+ error = assert_raises(RuntimeError) do
250
249
  reader.expand
251
250
  end
252
251
  assert_equal("The reader does not have a document. Did you forget to call read?", error.to_s)
@@ -267,7 +266,7 @@ class TestReader < Test::Unit::TestCase
267
266
  reader.next
268
267
 
269
268
  # The previous node is now invalid
270
- error = assert_raise(RuntimeError) do
269
+ error = assert_raises(RuntimeError) do
271
270
  assert_equal('feed', node.name)
272
271
  end
273
272
  assert_equal("This node has already been freed.", error.to_s)
@@ -370,7 +369,7 @@ class TestReader < Test::Unit::TestCase
370
369
  xml = "<bands genre=\"metal\">\n <m\366tley_cr\374e country=\"us\">An American heavy metal band formed in Los Angeles, California in 1981.</m\366tley_cr\374e>\n <iron_maiden country=\"uk\">British heavy metal band formed in 1975.</iron_maiden>\n</bands>"
371
370
 
372
371
  reader = XML::Reader.string(xml)
373
- error = assert_raise(XML::Error) do
372
+ error = assert_raises(XML::Error) do
374
373
  node = reader.read
375
374
  end
376
375
 
data/test/tc_relaxng.rb CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  require './test_helper'
4
4
 
5
- require 'test/unit'
6
5
 
7
- class TestRelaxNG < Test::Unit::TestCase
6
+ class TestRelaxNG < Minitest::Test
8
7
  def setup
9
8
  file = File.join(File.dirname(__FILE__), 'model/shiporder.xml')
10
9
  @doc = XML::Document.file(file)
@@ -31,11 +30,11 @@ class TestRelaxNG < Test::Unit::TestCase
31
30
  new_node = XML::Node.new('invalid', 'this will mess up validation')
32
31
  @doc.root << new_node
33
32
 
34
- error = assert_raise(XML::Error) do
33
+ error = assert_raises(XML::Error) do
35
34
  @doc.validate_relaxng(relaxng)
36
35
  end
37
36
 
38
- assert_not_nil(error)
37
+ refute_nil(error)
39
38
  assert_kind_of(XML::Error, error)
40
39
  assert(error.message.match(/Error: Did not expect element invalid there/))
41
40
  assert_equal(XML::Error::RELAXNGV, error.domain)
@@ -48,7 +47,7 @@ class TestRelaxNG < Test::Unit::TestCase
48
47
  assert_nil(error.str3)
49
48
  assert_equal(0, error.int1)
50
49
  assert_equal(0, error.int2)
51
- assert_not_nil(error.node)
50
+ refute_nil(error.node)
52
51
  assert_equal('invalid', error.node.name)
53
52
  end
54
53
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require './test_helper'
4
4
  require 'stringio'
5
- require 'test/unit'
6
5
 
7
6
  class DocTypeCallback
8
7
  include XML::SaxParser::Callbacks
@@ -68,7 +67,7 @@ class TestCaseCallbacks
68
67
  end
69
68
  end
70
69
 
71
- class TestSaxParser < Test::Unit::TestCase
70
+ class TestSaxParser < Minitest::Test
72
71
  def saxtest_file
73
72
  File.join(File.dirname(__FILE__), 'model/atom.xml')
74
73
  end
@@ -132,7 +131,7 @@ class TestSaxParser < Test::Unit::TestCase
132
131
  end
133
132
 
134
133
  def test_noexistent_file
135
- error = assert_raise(XML::Error) do
134
+ error = assert_raises(XML::Error) do
136
135
  XML::SaxParser.file('i_dont_exist.xml')
137
136
  end
138
137
 
@@ -140,7 +139,7 @@ class TestSaxParser < Test::Unit::TestCase
140
139
  end
141
140
 
142
141
  def test_nil_file
143
- error = assert_raise(TypeError) do
142
+ error = assert_raises(TypeError) do
144
143
  XML::SaxParser.file(nil)
145
144
  end
146
145
 
@@ -157,7 +156,7 @@ class TestSaxParser < Test::Unit::TestCase
157
156
  end
158
157
 
159
158
  def test_nil_io
160
- error = assert_raise(TypeError) do
159
+ error = assert_raises(TypeError) do
161
160
  XML::HTMLParser.io(nil)
162
161
  end
163
162
 
@@ -189,7 +188,7 @@ class TestSaxParser < Test::Unit::TestCase
189
188
  end
190
189
 
191
190
  def test_nil_string
192
- error = assert_raise(TypeError) do
191
+ error = assert_raises(TypeError) do
193
192
  XML::SaxParser.string(nil)
194
193
  end
195
194
 
@@ -207,7 +206,7 @@ EOS
207
206
  parser = XML::SaxParser.string(xml)
208
207
  parser.callbacks = DocTypeCallback.new
209
208
  doc = parser.parse
210
- assert_not_nil(doc)
209
+ refute_nil(doc)
211
210
  end
212
211
 
213
212
  def test_parse_warning
@@ -243,7 +242,7 @@ EOS
243
242
  parser = XML::SaxParser.string(xml)
244
243
  parser.callbacks = TestCaseCallbacks.new
245
244
 
246
- error = assert_raise(XML::Error) do
245
+ error = assert_raises(XML::Error) do
247
246
  doc = parser.parse
248
247
  end
249
248
 
@@ -258,7 +257,7 @@ EOS
258
257
  assert_equal("error: Fatal error: Premature end of data in tag Results line 1 at :2.", result[i+=1])
259
258
  assert_equal("end_document", result[i+=1])
260
259
 
261
- assert_not_nil(error)
260
+ refute_nil(error)
262
261
  assert_kind_of(XML::Error, error)
263
262
  assert_equal("Fatal error: Premature end of data in tag Results line 1 at :2.", error.message)
264
263
  assert_equal(XML::Error::PARSER, error.domain)
@@ -309,7 +308,7 @@ EOS
309
308
  parser = XML::SaxParser.string(xml)
310
309
  parser.callbacks = TestCaseCallbacks.new
311
310
 
312
- error = assert_raise(XML::Error) do
311
+ error = assert_raises(XML::Error) do
313
312
  parser.parse
314
313
  end
315
314
  assert_equal("Fatal error: xmlParseEntityRef: no name at :5.", error.to_s)
data/test/tc_schema.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require './test_helper'
4
- require 'test/unit'
5
4
 
6
- class TestSchema < Test::Unit::TestCase
5
+ class TestSchema < Minitest::Test
7
6
  def setup
8
7
  file = File.join(File.dirname(__FILE__), 'model/shiporder.xml')
9
8
  @doc = XML::Document.file(file)
@@ -19,7 +18,7 @@ class TestSchema < Test::Unit::TestCase
19
18
  end
20
19
 
21
20
  def check_error(error)
22
- assert_not_nil(error)
21
+ refute_nil(error)
23
22
  assert(error.message.match(/Error: Element 'invalid': This element is not expected. Expected is \( item \)/))
24
23
  assert_kind_of(XML::Error, error)
25
24
  assert_equal(XML::Error::SCHEMASV, error.domain)
@@ -45,13 +44,13 @@ class TestSchema < Test::Unit::TestCase
45
44
  new_node = XML::Node.new('invalid', 'this will mess up validation')
46
45
  @doc.root << new_node
47
46
 
48
- error = assert_raise(XML::Error) do
47
+ error = assert_raises(XML::Error) do
49
48
  @doc.validate_schema(schema)
50
49
  end
51
50
 
52
51
  check_error(error)
53
52
  assert_nil(error.line)
54
- assert_not_nil(error.node)
53
+ refute_nil(error.node)
55
54
  assert_equal('invalid', error.node.name)
56
55
  end
57
56
 
data/test/tc_traversal.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require './test_helper'
4
- require 'test/unit'
5
4
 
6
- class TestTranversal < Test::Unit::TestCase
5
+ class TestTranversal < Minitest::Test
7
6
  ROOT_NODES_LENGTH = 27
8
7
  ROOT_ELEMENTS_LENGTH = 13
9
8
 
data/test/tc_writer.rb CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  require './test_helper'
4
4
  require 'stringio'
5
- require 'test/unit'
6
5
 
7
- class TestWriter < Test::Unit::TestCase
6
+ class TestWriter < Minitest::Test
8
7
  XSL_PREFIX = 'xsl'
9
8
  XSL_URI = 'http://www.w3.org/1999/XSL/Transform'
10
9
 
data/test/tc_xinclude.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require './test_helper'
4
- require 'test/unit'
5
4
 
6
- class TestXInclude < Test::Unit::TestCase
5
+ class TestXInclude < Minitest::Test
7
6
  def setup
8
7
  @doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/xinclude.xml'))
9
8
  assert_instance_of(XML::Document, @doc)
data/test/tc_xml.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require './test_helper'
4
- require 'test/unit'
5
4
  require 'stringio'
6
5
 
7
- class TestXml < Test::Unit::TestCase
6
+ class TestXml < Minitest::Test
8
7
  # ----- Constants ------
9
8
  def test_lib_versions
10
9
  assert(XML.check_lib_versions)
data/test/tc_xpath.rb CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  require './test_helper'
4
4
  require 'tempfile'
5
- require 'test/unit'
6
5
 
7
- class TestXPath < Test::Unit::TestCase
6
+ class TestXPath < Minitest::Test
8
7
  def setup
9
8
  @doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
10
9
  end
@@ -109,17 +108,17 @@ class TestXPath < Test::Unit::TestCase
109
108
  doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/atom.xml'))
110
109
 
111
110
  # No namespace has been yet defined
112
- assert_raise(XML::Error) do
111
+ assert_raises(XML::Error) do
113
112
  node = doc.find("atom:title")
114
113
  end
115
114
 
116
115
  node = doc.find('atom:title', 'atom:http://www.w3.org/2005/Atom')
117
- assert_not_nil(node)
116
+ refute_nil(node)
118
117
 
119
118
  # Register namespace
120
119
  doc.root.namespaces.default_prefix = 'atom'
121
120
  node = doc.find("atom:title")
122
- assert_not_nil(node)
121
+ refute_nil(node)
123
122
  end
124
123
 
125
124
  def test_node_find
@@ -145,7 +144,7 @@ class TestXPath < Test::Unit::TestCase
145
144
 
146
145
  def test_node_no_doc
147
146
  node = XML::Node.new('header', 'some content')
148
- assert_raise(TypeError) do
147
+ assert_raises(TypeError) do
149
148
  node = node.find_first('/header')
150
149
  end
151
150
  end
@@ -201,20 +200,20 @@ class TestXPath < Test::Unit::TestCase
201
200
  def test_xpath_empty_result
202
201
  doc = XML::Document.string('<html><body><p>Welcome to XHTML land!</p></body></html>')
203
202
  nodes = doc.find("//object/param[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'wmode']")
204
- assert_not_nil nodes
203
+ refute_nil nodes
205
204
  end
206
205
 
207
206
  def test_invalid_expression
208
207
  xml = LibXML::XML::Document.string('<a></a>')
209
208
 
210
209
  # Using the expression twice used to cause a Segmentation Fault
211
- error = assert_raise(XML::Error) do
210
+ error = assert_raises(XML::Error) do
212
211
  xml.find('//a/')
213
212
  end
214
213
  assert_equal("Error: Invalid expression.", error.to_s)
215
214
 
216
215
  # Try again - this used to cause a Segmentation Fault
217
- error = assert_raise(XML::Error) do
216
+ error = assert_raises(XML::Error) do
218
217
  xml.find('//a/')
219
218
  end
220
219
  assert_equal("Error: Invalid expression.", error.to_s)
@@ -2,9 +2,8 @@
2
2
 
3
3
  require './test_helper'
4
4
  require "tempfile"
5
- require "test/unit"
6
5
 
7
- class TestXPathContext < Test::Unit::TestCase
6
+ class TestXPathContext < Minitest::Test
8
7
  SOAP_PREFIX = 'soap'
9
8
  SOAP_URI = 'http://schemas.xmlsoap.org/soap/envelope/'
10
9
 
@@ -21,7 +20,7 @@ class TestXPathContext < Test::Unit::TestCase
21
20
  end
22
21
 
23
22
  def test_no_ns
24
- error = assert_raise(LibXML::XML::Error) do
23
+ error = assert_raises(LibXML::XML::Error) do
25
24
  @context.find('/soap:Envelope')
26
25
  end
27
26
  assert_equal("Error: Undefined namespace prefix.", error.to_s)
@@ -81,7 +80,7 @@ class TestXPathContext < Test::Unit::TestCase
81
80
 
82
81
  def test_require_doc
83
82
  doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/soap.xml'))
84
- error = assert_raise(TypeError) do
83
+ error = assert_raises(TypeError) do
85
84
  @context = XML::XPath::Context.new(doc.root)
86
85
  end
87
86
  assert_equal("Supplied argument must be a document or node.", error.to_s)
@@ -2,9 +2,8 @@
2
2
 
3
3
  require './test_helper'
4
4
 
5
- require 'test/unit'
6
5
 
7
- class TestXPathExpression < Test::Unit::TestCase
6
+ class TestXPathExpression < Minitest::Test
8
7
  def setup
9
8
  xp = XML::Parser.string('<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>')
10
9
  @doc = xp.parse
@@ -29,10 +28,10 @@ class TestXPathExpression < Test::Unit::TestCase
29
28
  end
30
29
 
31
30
  def test_find_invalid
32
- error = assert_raise(TypeError) do
31
+ error = assert_raises(TypeError) do
33
32
  set = @doc.find(999)
34
33
  end
35
- assert_equal('Argument should be an intance of a String or XPath::Expression',
34
+ assert_equal('Argument should be an instance of a String or XPath::Expression',
36
35
  error.to_s)
37
36
  end
38
37
  end
data/test/tc_xpointer.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  # encoding: UTF-8
2
-
3
2
  require './test_helper'
4
- require "test/unit"
5
3
 
6
- class TC_XML_XPointer < Test::Unit::TestCase
4
+ class TC_XML_XPointer < Minitest::Test
7
5
  def setup()
8
6
  xp = XML::Parser.string('<!DOCTYPE ra [<!ELEMENT ra (foo+)><!ATTLIST ra id ID #IMPLIED><!ELEMENT foo (#PCDATA)><!ATTLIST foo id ID #IMPLIED>]><ra id="start"><foo id="one">one</foo><foo id="two">two</foo><foo id="three">three</foo></ra>')
9
7
  @doc = xp.parse
data/test/test_helper.rb CHANGED
@@ -11,4 +11,6 @@ $LOAD_PATH << lib
11
11
  $LOAD_PATH << ext
12
12
 
13
13
  require 'xml'
14
-
14
+ require 'minitest/autorun'
15
+ # require 'minitest/reporters'
16
+ # MiniTest::Reporters.use!
data/test/test_suite.rb CHANGED
@@ -40,7 +40,6 @@ require './tc_xpath_context'
40
40
  require './tc_xpath_expression'
41
41
  require './tc_xpointer'
42
42
 
43
-
44
43
  if defined?(Encoding)
45
44
  require './tc_encoding'
46
45
  require './tc_encoding_sax'