libxml-ruby 4.1.2-x64-mingw-ucrt → 5.0.1-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +17 -0
  3. data/README.rdoc +7 -16
  4. data/ext/libxml/ruby_libxml.h +43 -44
  5. data/ext/libxml/ruby_xml.c +0 -343
  6. data/ext/libxml/ruby_xml.h +9 -10
  7. data/ext/libxml/ruby_xml_attributes.h +2 -0
  8. data/ext/libxml/ruby_xml_document.c +6 -6
  9. data/ext/libxml/ruby_xml_document.h +11 -11
  10. data/ext/libxml/ruby_xml_dtd.c +85 -79
  11. data/ext/libxml/ruby_xml_encoding.h +20 -18
  12. data/ext/libxml/ruby_xml_error.c +9 -6
  13. data/ext/libxml/ruby_xml_error.h +2 -2
  14. data/ext/libxml/ruby_xml_html_parser_context.c +35 -21
  15. data/ext/libxml/ruby_xml_namespace.c +0 -3
  16. data/ext/libxml/ruby_xml_node.c +1394 -1398
  17. data/ext/libxml/ruby_xml_parser.h +1 -1
  18. data/ext/libxml/ruby_xml_parser_context.c +47 -39
  19. data/ext/libxml/ruby_xml_parser_options.c +9 -1
  20. data/ext/libxml/ruby_xml_parser_options.h +1 -1
  21. data/ext/libxml/ruby_xml_reader.c +15 -16
  22. data/ext/libxml/ruby_xml_sax2_handler.c +1 -1
  23. data/ext/libxml/ruby_xml_sax_parser.c +1 -9
  24. data/ext/libxml/ruby_xml_schema.c +4 -4
  25. data/ext/libxml/ruby_xml_version.h +5 -5
  26. data/ext/libxml/ruby_xml_writer.c +8 -8
  27. data/ext/libxml/ruby_xml_xpath.c +1 -1
  28. data/ext/libxml/ruby_xml_xpath_context.c +2 -2
  29. data/ext/libxml/ruby_xml_xpath_expression.c +1 -1
  30. data/lib/3.2/libxml_ruby.so +0 -0
  31. data/lib/3.3/libxml_ruby.so +0 -0
  32. data/lib/libxml/document.rb +15 -15
  33. data/lib/libxml/html_parser.rb +23 -23
  34. data/lib/libxml/parser.rb +26 -24
  35. data/test/test.rb +5 -0
  36. data/test/test_document.rb +8 -0
  37. data/test/test_document_write.rb +1 -4
  38. data/test/test_dtd.rb +5 -8
  39. data/test/test_encoding.rb +1 -4
  40. data/test/test_helper.rb +9 -2
  41. data/test/test_html_parser.rb +162 -162
  42. data/test/test_namespace.rb +1 -3
  43. data/test/test_node.rb +1 -3
  44. data/test/test_node_write.rb +1 -4
  45. data/test/test_parser.rb +26 -17
  46. data/test/test_reader.rb +4 -4
  47. data/test/test_sax_parser.rb +1 -1
  48. data/test/test_xml.rb +0 -99
  49. metadata +5 -3
  50. data/lib/3.1/libxml_ruby.so +0 -0
data/test/test_node.rb CHANGED
@@ -7,13 +7,11 @@ class TestNode < Minitest::Test
7
7
  @file_name = "model/bands.utf-8.xml"
8
8
 
9
9
  # Strip spaces to make testing easier
10
- LibXML::XML.default_keep_blanks = false
11
10
  file = File.join(File.dirname(__FILE__), @file_name)
12
- @doc = LibXML::XML::Document.file(file)
11
+ @doc = LibXML::XML::Document.file(file, options: LibXML::XML::Parser::Options::NOBLANKS)
13
12
  end
14
13
 
15
14
  def teardown
16
- LibXML::XML.default_keep_blanks = true
17
15
  @doc = nil
18
16
  end
19
17
 
@@ -8,7 +8,6 @@ class TestNodeWrite < Minitest::Test
8
8
  end
9
9
 
10
10
  def teardown
11
- LibXML::XML.default_keep_blanks = true
12
11
  @doc = nil
13
12
  end
14
13
 
@@ -16,10 +15,8 @@ class TestNodeWrite < Minitest::Test
16
15
  @encoding = Encoding.find(name)
17
16
  @file_name = "model/bands.#{name.downcase}.xml"
18
17
 
19
- # Strip spaces to make testing easier
20
- LibXML::XML.default_keep_blanks = false
21
18
  file = File.join(File.dirname(__FILE__), @file_name)
22
- @doc = LibXML::XML::Document.file(file)
19
+ @doc = LibXML::XML::Document.file(file, options: LibXML::XML::Parser::Options::NOBLANKS)
23
20
  end
24
21
 
25
22
  def test_to_s_default
data/test/test_parser.rb CHANGED
@@ -27,7 +27,7 @@ class TestParser < Minitest::Test
27
27
  LibXML::XML::Parser.document(nil)
28
28
  end
29
29
 
30
- assert_equal("Must pass an LibXML::XML::Document object", error.to_s)
30
+ assert_equal("Must pass an LibXML::XML::Document object", error.message)
31
31
  end
32
32
 
33
33
  def test_file
@@ -44,7 +44,7 @@ class TestParser < Minitest::Test
44
44
  LibXML::XML::Parser.file('i_dont_exist.xml')
45
45
  end
46
46
 
47
- assert_equal('Warning: failed to load external entity "i_dont_exist.xml".', error.to_s)
47
+ assert_equal('Warning: failed to load external entity "i_dont_exist.xml".', error.message)
48
48
  end
49
49
 
50
50
  def test_nil_file
@@ -52,7 +52,7 @@ class TestParser < Minitest::Test
52
52
  LibXML::XML::Parser.file(nil)
53
53
  end
54
54
 
55
- assert_match(/nil into String/, error.to_s)
55
+ assert_match(/nil into String/, error.message)
56
56
  end
57
57
 
58
58
  def test_file_encoding
@@ -63,7 +63,11 @@ class TestParser < Minitest::Test
63
63
  parser.parse
64
64
  end
65
65
 
66
- assert(error.to_s.match(/Fatal error: Extra content at the end of the document/))
66
+ if windows?
67
+ assert_match(/Fatal error: Opening and ending tag mismatch/, error.message)
68
+ else
69
+ assert_match(/Fatal error: Extra content at the end of the document/, error.message)
70
+ end
67
71
 
68
72
  parser = LibXML::XML::Parser.file(file, :encoding => LibXML::XML::Encoding::UTF_8)
69
73
  doc = parser.parse
@@ -108,7 +112,7 @@ class TestParser < Minitest::Test
108
112
  LibXML::XML::Parser.io(nil)
109
113
  end
110
114
 
111
- assert_equal("Must pass in an IO object", error.to_s)
115
+ assert_equal("Must pass in an IO object", error.message)
112
116
  end
113
117
 
114
118
  def test_string_io
@@ -153,7 +157,7 @@ class TestParser < Minitest::Test
153
157
  LibXML::XML::Parser.string(nil)
154
158
  end
155
159
 
156
- assert_equal("wrong argument type nil (expected String)", error.to_s)
160
+ assert_equal("wrong argument type nil (expected String)", error.message)
157
161
  end
158
162
 
159
163
  def test_string_options
@@ -165,9 +169,7 @@ class TestParser < Minitest::Test
165
169
  </test>
166
170
  EOS
167
171
 
168
- LibXML::XML::default_substitute_entities = false
169
-
170
- # Parse normally
172
+ # Parse normally - entities won't be substituted
171
173
  parser = LibXML::XML::Parser.string(xml)
172
174
  doc = parser.parse
173
175
  assert_nil(doc.child.base_uri)
@@ -176,13 +178,13 @@ class TestParser < Minitest::Test
176
178
  node = doc.find_first('/test/cdata').child
177
179
  assert_equal(LibXML::XML::Node::CDATA_SECTION_NODE, node.node_type)
178
180
 
179
- # Entities should not be subtituted
181
+ # Entities should not be substituted
180
182
  node = doc.find_first('/test/entity')
181
183
  assert_equal('&foo;', node.child.to_s)
182
184
 
183
185
  # Parse with options
184
- parser = LibXML::XML::Parser.string(xml, :base_uri => 'http://libxml.rubyforge.org',
185
- :options => LibXML::XML::Parser::Options::NOCDATA | LibXML::XML::Parser::Options::NOENT)
186
+ parser = LibXML::XML::Parser.string(xml, base_uri: 'http://libxml.rubyforge.org',
187
+ options: LibXML::XML::Parser::Options::NOCDATA | LibXML::XML::Parser::Options::NOENT)
186
188
  doc = parser.parse
187
189
  assert_equal(doc.child.base_uri, 'http://libxml.rubyforge.org')
188
190
 
@@ -214,7 +216,7 @@ class TestParser < Minitest::Test
214
216
  end
215
217
 
216
218
  assert_equal("Fatal error: Input is not proper UTF-8, indicate encoding !\nBytes: 0xF6 0x74 0x6C 0x65 at :2.",
217
- error.to_s)
219
+ error.message)
218
220
 
219
221
  # Parse as ISO_8859_1:
220
222
  parser = LibXML::XML::Parser.string(xml, :encoding => LibXML::XML::Encoding::ISO_8859_1)
@@ -283,16 +285,23 @@ class TestParser < Minitest::Test
283
285
 
284
286
  refute_nil(error)
285
287
  assert_kind_of(LibXML::XML::Error, error)
286
- assert_equal("Fatal error: Extra content at the end of the document at :1.", error.message)
288
+ if windows?
289
+ assert_equal("Fatal error: Couldn't find end of Start Tag ruby_array line 1 at :1.", error.message)
290
+ assert_equal(LibXML::XML::Error::GT_REQUIRED, error.code)
291
+ assert_equal("ruby_array", error.str1)
292
+ assert_equal(1, error.int1)
293
+ else
294
+ assert_equal("Fatal error: Extra content at the end of the document at :1.", error.message)
295
+ assert_equal(LibXML::XML::Error::DOCUMENT_END, error.code)
296
+ assert_nil(error.str1)
297
+ assert_equal(0, error.int1)
298
+ end
287
299
  assert_equal(LibXML::XML::Error::PARSER, error.domain)
288
- assert_equal(LibXML::XML::Error::DOCUMENT_END, error.code)
289
300
  assert_equal(LibXML::XML::Error::FATAL, error.level)
290
301
  assert_nil(error.file)
291
302
  assert_equal(1, error.line)
292
- assert_nil(error.str1)
293
303
  assert_nil(error.str2)
294
304
  assert_nil(error.str3)
295
- assert_equal(0, error.int1)
296
305
  assert_equal(34, error.int2)
297
306
  assert_nil(error.node)
298
307
  end
data/test/test_reader.rb CHANGED
@@ -60,9 +60,10 @@ class TestReader < Minitest::Test
60
60
  end
61
61
 
62
62
  def test_invalid_file
63
- assert_raises(LibXML::XML::Error) do
63
+ error = assert_raises(Errno::ENOENT) do
64
64
  LibXML::XML::Reader.file('/does/not/exist')
65
65
  end
66
+ assert_equal("No such file or directory - /does/not/exist", error.message)
66
67
  end
67
68
 
68
69
  def test_string
@@ -256,7 +257,6 @@ class TestReader < Minitest::Test
256
257
  end
257
258
 
258
259
  def test_node
259
- LibXML::XML.default_line_numbers = true
260
260
  reader = LibXML::XML::Reader.file(XML_FILE)
261
261
 
262
262
  # first try to get a node
@@ -358,7 +358,7 @@ class TestReader < Minitest::Test
358
358
  reader = LibXML::XML::Reader.string(xml, :encoding => LibXML::XML::Encoding::ISO_8859_1)
359
359
  reader.read
360
360
 
361
- # Encoding is always null for strings, very annoying!
362
- assert_equal(reader.encoding, LibXML::XML::Encoding::NONE)
361
+ encoding = windows? ? LibXML::XML::Encoding::ISO_8859_1 : LibXML::XML::Encoding::NONE
362
+ assert_equal(reader.encoding, encoding)
363
363
  end
364
364
  end
@@ -318,7 +318,7 @@ EOS
318
318
  error = assert_raises(LibXML::XML::Error) do
319
319
  parser.parse
320
320
  end
321
- assert_equal("Fatal error: xmlParseEntityRef: no name at :5.", error.to_s)
321
+ assert_match("Fatal error: xmlParseEntityRef: no name at", error.to_s)
322
322
 
323
323
  # Check callbacks
324
324
  parser.callbacks.result
data/test/test_xml.rb CHANGED
@@ -9,21 +9,6 @@ class TestXml < Minitest::Test
9
9
  assert(LibXML::XML.check_lib_versions)
10
10
  end
11
11
 
12
- def test_debug_entities
13
- original = LibXML::XML.debug_entities
14
-
15
- LibXML::XML.debug_entities = false
16
- refute(LibXML::XML.debug_entities)
17
-
18
- LibXML::XML.debug_entities = true
19
- assert(LibXML::XML.debug_entities)
20
-
21
- LibXML::XML.debug_entities = false
22
- refute(LibXML::XML.debug_entities)
23
-
24
- LibXML::XML.debug_entities = original
25
- end
26
-
27
12
  def test_default_compression
28
13
  return unless LibXML::XML.default_compression
29
14
 
@@ -52,52 +37,6 @@ class TestXml < Minitest::Test
52
37
  LibXML::XML.default_compression = original
53
38
  end
54
39
 
55
- def test_default_keep_blanks
56
- original = LibXML::XML.default_keep_blanks
57
-
58
- LibXML::XML.default_keep_blanks = false
59
- refute(LibXML::XML.default_keep_blanks)
60
- assert_equal(LibXML::XML::Parser::Options::NOBLANKS, LibXML::XML.default_options)
61
-
62
- LibXML::XML.default_keep_blanks = true
63
- assert(LibXML::XML.default_keep_blanks)
64
- assert_equal(0, LibXML::XML.default_options)
65
-
66
- LibXML::XML.default_keep_blanks = original
67
- end
68
-
69
- def test_default_line_numbers
70
- original = LibXML::XML.default_line_numbers
71
-
72
- LibXML::XML.default_line_numbers = false
73
- refute(LibXML::XML.default_line_numbers)
74
-
75
- LibXML::XML.default_line_numbers = true
76
- assert(LibXML::XML.default_line_numbers)
77
-
78
- LibXML::XML.default_line_numbers = false
79
- refute(LibXML::XML.default_line_numbers)
80
-
81
- LibXML::XML.default_line_numbers = original
82
- end
83
-
84
- def test_default_substitute_entities
85
- original = LibXML::XML.default_substitute_entities
86
-
87
- LibXML::XML.default_substitute_entities = false
88
- refute(LibXML::XML.default_substitute_entities)
89
- assert_equal(0, LibXML::XML.default_options)
90
-
91
- LibXML::XML.default_substitute_entities = true
92
- assert(LibXML::XML.default_substitute_entities)
93
- assert_equal(LibXML::XML::Parser::Options::NOENT, LibXML::XML.default_options)
94
-
95
- LibXML::XML.default_substitute_entities = false
96
- refute(LibXML::XML.default_substitute_entities)
97
-
98
- LibXML::XML.default_substitute_entities = original
99
- end
100
-
101
40
  def test_default_tree_indent_string
102
41
  original = LibXML::XML.default_tree_indent_string
103
42
 
@@ -116,40 +55,6 @@ class TestXml < Minitest::Test
116
55
  LibXML::XML.default_tree_indent_string = original
117
56
  end
118
57
 
119
- def test_default_validity_checking
120
- original = LibXML::XML.default_validity_checking
121
-
122
- LibXML::XML.default_validity_checking = false
123
- refute(LibXML::XML.default_validity_checking)
124
- assert_equal(0, LibXML::XML.default_options)
125
-
126
- LibXML::XML.default_validity_checking = true
127
- assert(LibXML::XML.default_validity_checking)
128
- assert_equal(LibXML::XML::Parser::Options::DTDVALID, LibXML::XML.default_options)
129
-
130
- LibXML::XML.default_validity_checking = false
131
- refute(LibXML::XML.default_validity_checking)
132
-
133
- LibXML::XML.default_validity_checking = original
134
- end
135
-
136
- def test_default_warnings
137
- original = LibXML::XML.default_warnings
138
-
139
- LibXML::XML.default_warnings = false
140
- refute(LibXML::XML.default_warnings)
141
- assert_equal(LibXML::XML::Parser::Options::NOWARNING, LibXML::XML.default_options)
142
-
143
- LibXML::XML.default_warnings = true
144
- assert(LibXML::XML.default_warnings)
145
- assert_equal(0, LibXML::XML.default_options)
146
-
147
- LibXML::XML.default_warnings = false
148
- refute(LibXML::XML.default_warnings)
149
-
150
- LibXML::XML.default_warnings = original
151
- end
152
-
153
58
  def test_enabled_automata
154
59
  assert(LibXML::XML.enabled_automata?)
155
60
  end
@@ -249,10 +154,6 @@ class TestXml < Minitest::Test
249
154
  assert_instance_of(Integer, LibXML::XML::VERNUM)
250
155
  end
251
156
 
252
- def test_default_options
253
- assert_equal(0, LibXML::XML.default_options)
254
- end
255
-
256
157
  def test_default_save_no_empty_tags
257
158
  original = LibXML::XML.default_save_no_empty_tags
258
159
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libxml-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 5.0.1
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Ross Bamform
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2023-11-04 00:00:00.000000000 Z
17
+ date: 2024-01-08 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake-compiler
@@ -135,7 +135,8 @@ files:
135
135
  - ext/libxml/ruby_xml_xpath_object.c
136
136
  - ext/libxml/ruby_xml_xpath_object.h
137
137
  - ext/vc/libxml_ruby.sln
138
- - lib/3.1/libxml_ruby.so
138
+ - lib/3.2/libxml_ruby.so
139
+ - lib/3.3/libxml_ruby.so
139
140
  - lib/libxml-ruby.rb
140
141
  - lib/libxml.rb
141
142
  - lib/libxml/attr.rb
@@ -216,6 +217,7 @@ files:
216
217
  - test/model/shiporder_import.xsd
217
218
  - test/model/soap.xml
218
219
  - test/model/xinclude.xml
220
+ - test/test.rb
219
221
  - test/test_attr.rb
220
222
  - test/test_attr_decl.rb
221
223
  - test/test_attributes.rb
Binary file