libxml-ruby 4.1.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +22 -0
  3. data/ext/libxml/extconf.rb +67 -61
  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_attr_decl.c +154 -153
  8. data/ext/libxml/ruby_xml_attributes.c +276 -275
  9. data/ext/libxml/ruby_xml_attributes.h +2 -0
  10. data/ext/libxml/ruby_xml_document.c +6 -6
  11. data/ext/libxml/ruby_xml_document.h +11 -11
  12. data/ext/libxml/ruby_xml_dtd.c +3 -3
  13. data/ext/libxml/ruby_xml_encoding.h +20 -18
  14. data/ext/libxml/ruby_xml_error.c +9 -6
  15. data/ext/libxml/ruby_xml_error.h +2 -2
  16. data/ext/libxml/ruby_xml_html_parser_context.c +35 -21
  17. data/ext/libxml/ruby_xml_namespace.c +0 -3
  18. data/ext/libxml/ruby_xml_node.c +1394 -1398
  19. data/ext/libxml/ruby_xml_parser.h +1 -1
  20. data/ext/libxml/ruby_xml_parser_context.c +47 -39
  21. data/ext/libxml/ruby_xml_parser_options.c +9 -1
  22. data/ext/libxml/ruby_xml_parser_options.h +1 -1
  23. data/ext/libxml/ruby_xml_reader.c +1244 -1242
  24. data/ext/libxml/ruby_xml_relaxng.c +113 -112
  25. data/ext/libxml/ruby_xml_sax2_handler.c +1 -1
  26. data/ext/libxml/ruby_xml_sax_parser.c +1 -9
  27. data/ext/libxml/ruby_xml_schema.c +422 -420
  28. data/ext/libxml/ruby_xml_schema_attribute.c +108 -107
  29. data/ext/libxml/ruby_xml_schema_element.c +70 -69
  30. data/ext/libxml/ruby_xml_schema_type.c +252 -251
  31. data/ext/libxml/ruby_xml_version.h +5 -5
  32. data/ext/libxml/ruby_xml_writer.c +1138 -1137
  33. data/ext/libxml/ruby_xml_xpath.c +1 -1
  34. data/ext/libxml/ruby_xml_xpath_context.c +2 -2
  35. data/ext/libxml/ruby_xml_xpath_expression.c +81 -81
  36. data/ext/libxml/ruby_xml_xpath_object.c +340 -339
  37. data/lib/libxml/document.rb +13 -13
  38. data/lib/libxml/html_parser.rb +23 -23
  39. data/lib/libxml/parser.rb +26 -24
  40. data/lib/libxml/schema/element.rb +27 -19
  41. data/test/test.rb +5 -0
  42. data/test/test_document_write.rb +1 -4
  43. data/test/test_dtd.rb +1 -4
  44. data/test/test_encoding.rb +1 -4
  45. data/test/test_helper.rb +9 -2
  46. data/test/test_html_parser.rb +162 -162
  47. data/test/test_namespace.rb +1 -3
  48. data/test/test_node.rb +1 -3
  49. data/test/test_node_write.rb +1 -4
  50. data/test/test_parser.rb +26 -17
  51. data/test/test_reader.rb +4 -4
  52. data/test/test_sax_parser.rb +1 -1
  53. data/test/test_schema.rb +237 -231
  54. data/test/test_xml.rb +0 -99
  55. metadata +4 -3
data/test/test_schema.rb CHANGED
@@ -1,231 +1,237 @@
1
- # encoding: UTF-8
2
-
3
- require_relative './test_helper'
4
-
5
- class TestSchema < Minitest::Test
6
- Import_NS = 'http://xml4r.org/libxml-ruby/test/shiporder'.freeze
7
-
8
- def setup
9
- file = File.join(File.dirname(__FILE__), 'model/shiporder.xml')
10
- @doc = LibXML::XML::Document.file(file)
11
- schema_file = File.join(File.dirname(__FILE__), 'model/shiporder.xsd')
12
- schema_doc = LibXML::XML::Document.file(schema_file)
13
- @schema = LibXML::XML::Schema.document(schema_doc)
14
- end
15
-
16
- def teardown
17
- @doc = nil
18
- @schema = nil
19
- end
20
-
21
- def check_error(error)
22
- refute_nil(error)
23
- assert(error.message.match(/Error: Element 'invalid': This element is not expected. Expected is \( item \)/))
24
- assert_kind_of(LibXML::XML::Error, error)
25
- assert_equal(LibXML::XML::Error::SCHEMASV, error.domain)
26
- assert_equal(LibXML::XML::Error::SCHEMAV_ELEMENT_CONTENT, error.code)
27
- assert_equal(LibXML::XML::Error::ERROR, error.level)
28
- assert(error.file.match(/shiporder.xml/)) if error.file
29
- assert_nil(error.str1)
30
- assert_nil(error.str2)
31
- assert_nil(error.str3)
32
- assert_equal(0, error.int1)
33
- assert_equal(0, error.int2)
34
- end
35
-
36
- def test_load_from_doc
37
- assert_instance_of(LibXML::XML::Schema, @schema)
38
- end
39
-
40
- def test_schema_load_from_uri
41
- xlink_schema = LibXML::XML::Schema.new('http://www.w3.org/1999/xlink.xsd')
42
- assert_instance_of(LibXML::XML::Schema, xlink_schema)
43
- assert_instance_of(LibXML::XML::Schema::Element, xlink_schema.elements['title'])
44
- assert_instance_of(LibXML::XML::Schema::Type, xlink_schema.types['titleEltType'])
45
- assert_equal('http://www.w3.org/1999/xlink', xlink_schema.target_namespace)
46
- end
47
-
48
- def test_schema_from_string
49
- schema_file = File.join(File.dirname(__FILE__), 'model/shiporder.xsd')
50
- schema_from_str = LibXML::XML::Schema.from_string(File.read(schema_file))
51
- assert_instance_of(LibXML::XML::Schema, schema_from_str)
52
- end
53
-
54
- def test_invalid_schema_doc
55
- bad_schema_file = File.join(File.dirname(__FILE__), 'model/shiporder_bad.xsd')
56
- bad_schema_doc = LibXML::XML::Document.file(bad_schema_file)
57
- bad_schema = nil
58
- ## Note: this type of error throws
59
- begin
60
- bad_schema = LibXML::XML::Schema.document(bad_schema_doc)
61
- rescue LibXML::XML::Error => error
62
- bad_schema = error
63
- assert(error.message.match(/Error: Element '.*': The content is not valid. Expected is \(/))
64
- assert_kind_of(LibXML::XML::Error, error)
65
- assert_equal(LibXML::XML::Error::SCHEMASP, error.domain)
66
- assert_equal(LibXML::XML::Error::SCHEMAP_S4S_ELEM_NOT_ALLOWED, error.code)
67
- assert_equal(LibXML::XML::Error::ERROR, error.level)
68
- assert(error.file.match(/shiporder_bad.xsd/))
69
- assert_equal("Element '{http://www.w3.org/2001/XMLSchema}complexType'", error.str1)
70
- refute_nil(error.str2)
71
- assert_nil(error.str3)
72
- assert_equal(0, error.int1)
73
- assert_equal(0, error.int2)
74
- end
75
- ## Last but not least, make sure we threw an error
76
- assert_instance_of(LibXML::XML::Error, bad_schema)
77
- end
78
-
79
- def test_doc_valid
80
- assert(@doc.validate_schema(@schema))
81
- end
82
-
83
- def test_doc_invalid
84
- new_node = LibXML::XML::Node.new('invalid', 'this will mess up validation')
85
- @doc.root << new_node
86
-
87
- error = assert_raises(LibXML::XML::Error) do
88
- @doc.validate_schema(@schema)
89
- end
90
-
91
- check_error(error)
92
- assert_nil(error.line)
93
- refute_nil(error.node)
94
- assert_equal('invalid', error.node.name)
95
- end
96
-
97
- def test_reader_valid
98
- reader = LibXML::XML::Reader.string(@doc.to_s)
99
- assert(reader.schema_validate(@schema))
100
-
101
- while reader.read
102
- end
103
- end
104
-
105
- def test_reader_invalid
106
- # Set error handler
107
- errors = Array.new
108
- LibXML::XML::Error.set_handler do |error|
109
- errors << error
110
- end
111
-
112
- new_node = LibXML::XML::Node.new('invalid', 'this will mess up validation')
113
- @doc.root << new_node
114
- reader = LibXML::XML::Reader.string(@doc.to_s)
115
-
116
- # Set a schema
117
- assert(reader.schema_validate(@schema))
118
-
119
- while reader.read
120
- end
121
-
122
- assert_equal(1, errors.length)
123
-
124
- error = errors.first
125
- check_error(error)
126
- assert_equal(21, error.line)
127
- ensure
128
- LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
129
- end
130
-
131
-
132
- # Schema meta-data tests
133
- def test_elements
134
- assert_instance_of(Hash, @schema.elements)
135
- assert_equal(1, @schema.elements.length)
136
- assert_instance_of(LibXML::XML::Schema::Element, @schema.elements['shiporder'])
137
- end
138
-
139
- def test_types
140
- assert_instance_of(Hash, @schema.types)
141
- assert_equal(1, @schema.types.length)
142
- assert_instance_of(LibXML::XML::Schema::Type, @schema.types['shiporderType'])
143
- end
144
-
145
- def test_imported_types
146
- assert_instance_of(Hash, @schema.imported_types)
147
- assert_equal(2, @schema.imported_types.length)
148
- assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_types['shiporderType'])
149
- assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_types['shiporderFooType'])
150
- end
151
-
152
- def test_imported_ns_types
153
- assert_instance_of(Hash, @schema.imported_ns_types)
154
- assert_equal(2, @schema.imported_ns_types.length)
155
- assert_equal(1, @schema.imported_ns_types[nil].length)
156
- assert_equal(1, @schema.imported_ns_types[Import_NS].length)
157
- assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_ns_types[nil]['shiporderType'])
158
- assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_ns_types[Import_NS]['shiporderFooType'])
159
- end
160
-
161
- def test_imported_ns_elements
162
- assert_instance_of(Hash, @schema.imported_ns_elements)
163
- assert_equal(2, @schema.imported_ns_elements.length)
164
- assert_equal(1, @schema.imported_ns_elements[nil].length)
165
- assert_equal(1, @schema.imported_ns_elements[Import_NS].length)
166
- assert_instance_of(LibXML::XML::Schema::Element, @schema.imported_ns_elements[nil]['shiporder'])
167
- assert_instance_of(LibXML::XML::Schema::Element, @schema.imported_ns_elements[Import_NS]['shiporder'])
168
- assert_equal('shiporderType', @schema.imported_ns_elements[nil]['shiporder'].type.name)
169
- assert_equal('shiporderFooType', @schema.imported_ns_elements[Import_NS]['shiporder'].type.name)
170
- end
171
-
172
- def test_namespaces
173
- assert_instance_of(Array, @schema.namespaces)
174
- ## For some reason, when importing another schema we end up with two xs->http://www.w3.org/2001/XMLSchema namespaces.
175
- ## So, we expect 3 here (one for Import_NS and then two for the schema namespace.
176
- assert_equal(3, @schema.namespaces.length)
177
- end
178
-
179
- def test_schema_type
180
- type = @schema.types['shiporderType']
181
-
182
- assert_equal('shiporderType', type.name)
183
- assert_nil(type.namespace)
184
- assert_equal("Shiporder type documentation", type.annotation)
185
- assert_instance_of(LibXML::XML::Node, type.node)
186
- assert_equal(LibXML::XML::Schema::Types::XML_SCHEMA_TYPE_COMPLEX, type.kind)
187
- assert_instance_of(LibXML::XML::Schema::Type, type.base)
188
- assert_equal("anyType", type.base.name)
189
- assert_equal(LibXML::XML::Schema::Types::XML_SCHEMA_TYPE_BASIC, type.base.kind)
190
-
191
- assert_instance_of(Hash, type.elements)
192
- assert_equal(3, type.elements.length)
193
- end
194
-
195
- def test_schema_element
196
- element = @schema.types['shiporderType'].elements['orderperson']
197
-
198
- assert_equal('orderperson', element.name)
199
- assert_nil(element.namespace)
200
- assert_equal("orderperson element documentation", element.annotation)
201
-
202
- element = @schema.types['shiporderType'].elements['item']
203
- assert_equal('item', element.name)
204
-
205
- element = @schema.types['shiporderType'].elements['item'].type.elements['note']
206
- assert_equal('note', element.name)
207
- assert_equal('string', element.type.name)
208
- end
209
-
210
- def test_schema_attributes
211
- type = @schema.types['shiporderType']
212
-
213
- assert_instance_of(Array, type.attributes)
214
- assert_equal(2, type.attributes.length)
215
- assert_instance_of(LibXML::XML::Schema::Attribute, type.attributes.first)
216
- end
217
-
218
- def test_schema_attribute
219
- attribute = @schema.types['shiporderType'].attributes.first
220
-
221
- assert_equal("orderid", attribute.name)
222
- assert_nil(attribute.namespace)
223
- assert_equal(1, attribute.occurs)
224
- assert_equal('string', attribute.type.name)
225
-
226
- attribute = @schema.types['shiporderType'].attributes[1]
227
- assert_equal(2, attribute.occurs)
228
- assert_equal('1', attribute.default)
229
- assert_equal('integer', attribute.type.name)
230
- end
231
- end
1
+ # encoding: UTF-8
2
+
3
+ require_relative './test_helper'
4
+
5
+ class TestSchema < Minitest::Test
6
+ Import_NS = 'http://xml4r.org/libxml-ruby/test/shiporder'.freeze
7
+
8
+ def setup
9
+ file = File.join(File.dirname(__FILE__), 'model/shiporder.xml')
10
+ @doc = LibXML::XML::Document.file(file)
11
+ schema_file = File.join(File.dirname(__FILE__), 'model/shiporder.xsd')
12
+ schema_doc = LibXML::XML::Document.file(schema_file)
13
+ @schema = LibXML::XML::Schema.document(schema_doc)
14
+ end
15
+
16
+ def teardown
17
+ @doc = nil
18
+ @schema = nil
19
+ end
20
+
21
+ def check_error(error)
22
+ refute_nil(error)
23
+ assert(error.message.match(/Error: Element 'invalid': This element is not expected. Expected is \( item \)/))
24
+ assert_kind_of(LibXML::XML::Error, error)
25
+ assert_equal(LibXML::XML::Error::SCHEMASV, error.domain)
26
+ assert_equal(LibXML::XML::Error::SCHEMAV_ELEMENT_CONTENT, error.code)
27
+ assert_equal(LibXML::XML::Error::ERROR, error.level)
28
+ assert(error.file.match(/shiporder.xml/)) if error.file
29
+ assert_nil(error.str1)
30
+ assert_nil(error.str2)
31
+ assert_nil(error.str3)
32
+ assert_equal(0, error.int1)
33
+ assert_equal(0, error.int2)
34
+ end
35
+
36
+ def test_load_from_doc
37
+ assert_instance_of(LibXML::XML::Schema, @schema)
38
+ end
39
+
40
+ def test_schema_load_from_uri
41
+ xlink_schema = LibXML::XML::Schema.new('http://www.w3.org/1999/xlink.xsd')
42
+ assert_instance_of(LibXML::XML::Schema, xlink_schema)
43
+ assert_instance_of(LibXML::XML::Schema::Element, xlink_schema.elements['title'])
44
+ assert_instance_of(LibXML::XML::Schema::Type, xlink_schema.types['titleEltType'])
45
+ assert_equal('http://www.w3.org/1999/xlink', xlink_schema.target_namespace)
46
+ end
47
+
48
+ def test_schema_from_string
49
+ schema_file = File.join(File.dirname(__FILE__), 'model/shiporder.xsd')
50
+ schema_from_str = LibXML::XML::Schema.from_string(File.read(schema_file))
51
+ assert_instance_of(LibXML::XML::Schema, schema_from_str)
52
+ end
53
+
54
+ def test_invalid_schema_doc
55
+ bad_schema_file = File.join(File.dirname(__FILE__), 'model/shiporder_bad.xsd')
56
+ bad_schema_doc = LibXML::XML::Document.file(bad_schema_file)
57
+ bad_schema = nil
58
+ ## Note: this type of error throws
59
+ begin
60
+ bad_schema = LibXML::XML::Schema.document(bad_schema_doc)
61
+ rescue LibXML::XML::Error => error
62
+ bad_schema = error
63
+ assert(error.message.match(/Error: Element '.*': The content is not valid. Expected is \(/))
64
+ assert_kind_of(LibXML::XML::Error, error)
65
+ assert_equal(LibXML::XML::Error::SCHEMASP, error.domain)
66
+ assert_equal(LibXML::XML::Error::SCHEMAP_S4S_ELEM_NOT_ALLOWED, error.code)
67
+ assert_equal(LibXML::XML::Error::ERROR, error.level)
68
+ assert(error.file.match(/shiporder_bad.xsd/))
69
+ assert_equal("Element '{http://www.w3.org/2001/XMLSchema}complexType'", error.str1)
70
+ refute_nil(error.str2)
71
+ assert_nil(error.str3)
72
+ assert_equal(0, error.int1)
73
+ assert_equal(0, error.int2)
74
+ end
75
+ ## Last but not least, make sure we threw an error
76
+ assert_instance_of(LibXML::XML::Error, bad_schema)
77
+ end
78
+
79
+ def test_doc_valid
80
+ assert(@doc.validate_schema(@schema))
81
+ end
82
+
83
+ def test_doc_invalid
84
+ new_node = LibXML::XML::Node.new('invalid', 'this will mess up validation')
85
+ @doc.root << new_node
86
+
87
+ error = assert_raises(LibXML::XML::Error) do
88
+ @doc.validate_schema(@schema)
89
+ end
90
+
91
+ check_error(error)
92
+ assert_nil(error.line)
93
+ refute_nil(error.node)
94
+ assert_equal('invalid', error.node.name)
95
+ end
96
+
97
+ def test_reader_valid
98
+ reader = LibXML::XML::Reader.string(@doc.to_s)
99
+ assert(reader.schema_validate(@schema))
100
+
101
+ while reader.read
102
+ end
103
+ end
104
+
105
+ def test_reader_invalid
106
+ # Set error handler
107
+ errors = Array.new
108
+ LibXML::XML::Error.set_handler do |error|
109
+ errors << error
110
+ end
111
+
112
+ new_node = LibXML::XML::Node.new('invalid', 'this will mess up validation')
113
+ @doc.root << new_node
114
+ reader = LibXML::XML::Reader.string(@doc.to_s)
115
+
116
+ # Set a schema
117
+ assert(reader.schema_validate(@schema))
118
+
119
+ while reader.read
120
+ end
121
+
122
+ assert_equal(1, errors.length)
123
+
124
+ error = errors.first
125
+ check_error(error)
126
+ assert_equal(21, error.line)
127
+ ensure
128
+ LibXML::XML::Error.set_handler(&LibXML::XML::Error::VERBOSE_HANDLER)
129
+ end
130
+
131
+
132
+ # Schema meta-data tests
133
+ def test_elements
134
+ assert_instance_of(Hash, @schema.elements)
135
+ assert_equal(1, @schema.elements.length)
136
+ assert_instance_of(LibXML::XML::Schema::Element, @schema.elements['shiporder'])
137
+ end
138
+
139
+ def test_types
140
+ assert_instance_of(Hash, @schema.types)
141
+ assert_equal(1, @schema.types.length)
142
+ assert_instance_of(LibXML::XML::Schema::Type, @schema.types['shiporderType'])
143
+ end
144
+
145
+ def test_imported_types
146
+ assert_instance_of(Hash, @schema.imported_types)
147
+ assert_equal(2, @schema.imported_types.length)
148
+ assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_types['shiporderType'])
149
+ assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_types['shiporderFooType'])
150
+ end
151
+
152
+ def test_imported_ns_types
153
+ assert_instance_of(Hash, @schema.imported_ns_types)
154
+ assert_equal(2, @schema.imported_ns_types.length)
155
+ assert_equal(1, @schema.imported_ns_types[nil].length)
156
+ assert_equal(1, @schema.imported_ns_types[Import_NS].length)
157
+ assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_ns_types[nil]['shiporderType'])
158
+ assert_instance_of(LibXML::XML::Schema::Type, @schema.imported_ns_types[Import_NS]['shiporderFooType'])
159
+ end
160
+
161
+ def test_imported_ns_elements
162
+ assert_instance_of(Hash, @schema.imported_ns_elements)
163
+ assert_equal(2, @schema.imported_ns_elements.length)
164
+ assert_equal(1, @schema.imported_ns_elements[nil].length)
165
+ assert_equal(1, @schema.imported_ns_elements[Import_NS].length)
166
+ assert_instance_of(LibXML::XML::Schema::Element, @schema.imported_ns_elements[nil]['shiporder'])
167
+ assert_instance_of(LibXML::XML::Schema::Element, @schema.imported_ns_elements[Import_NS]['shiporder'])
168
+ assert_equal('shiporderType', @schema.imported_ns_elements[nil]['shiporder'].type.name)
169
+ assert_equal('shiporderFooType', @schema.imported_ns_elements[Import_NS]['shiporder'].type.name)
170
+ end
171
+
172
+ def test_namespaces
173
+ assert_instance_of(Array, @schema.namespaces)
174
+ ## For some reason, when importing another schema we end up with two xs->http://www.w3.org/2001/XMLSchema namespaces.
175
+ ## So, we expect 3 here (one for Import_NS and then two for the schema namespace.
176
+ assert_equal(3, @schema.namespaces.length)
177
+ end
178
+
179
+ def test_schema_type
180
+ type = @schema.types['shiporderType']
181
+
182
+ assert_equal('shiporderType', type.name)
183
+ assert_nil(type.namespace)
184
+ assert_equal("Shiporder type documentation", type.annotation)
185
+ assert_instance_of(LibXML::XML::Node, type.node)
186
+ assert_equal(LibXML::XML::Schema::Types::XML_SCHEMA_TYPE_COMPLEX, type.kind)
187
+ assert_instance_of(LibXML::XML::Schema::Type, type.base)
188
+ assert_equal("anyType", type.base.name)
189
+ assert_equal(LibXML::XML::Schema::Types::XML_SCHEMA_TYPE_BASIC, type.base.kind)
190
+
191
+ assert_instance_of(Hash, type.elements)
192
+ assert_equal(3, type.elements.length)
193
+ end
194
+
195
+ def test_schema_element
196
+ element = @schema.types['shiporderType'].elements['orderperson']
197
+
198
+ assert_equal('orderperson', element.name)
199
+ assert_nil(element.namespace)
200
+ assert_equal("orderperson element documentation", element.annotation)
201
+ assert_equal(false, element.array?)
202
+ assert_equal(true, element.required?)
203
+
204
+ element = @schema.types['shiporderType'].elements['item']
205
+ assert_equal('item', element.name)
206
+ assert_equal(true, element.array?)
207
+ assert_equal(true, element.required?)
208
+
209
+ element = @schema.types['shiporderType'].elements['item'].type.elements['note']
210
+ assert_equal('note', element.name)
211
+ assert_equal('string', element.type.name)
212
+ assert_equal(false, element.array?)
213
+ assert_equal(false, element.required?)
214
+ end
215
+
216
+ def test_schema_attributes
217
+ type = @schema.types['shiporderType']
218
+
219
+ assert_instance_of(Array, type.attributes)
220
+ assert_equal(2, type.attributes.length)
221
+ assert_instance_of(LibXML::XML::Schema::Attribute, type.attributes.first)
222
+ end
223
+
224
+ def test_schema_attribute
225
+ attribute = @schema.types['shiporderType'].attributes.first
226
+
227
+ assert_equal("orderid", attribute.name)
228
+ assert_nil(attribute.namespace)
229
+ assert_equal(1, attribute.occurs)
230
+ assert_equal('string', attribute.type.name)
231
+
232
+ attribute = @schema.types['shiporderType'].attributes[1]
233
+ assert_equal(2, attribute.occurs)
234
+ assert_equal('1', attribute.default)
235
+ assert_equal('integer', attribute.type.name)
236
+ end
237
+ end
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.1
4
+ version: 5.0.0
5
5
  platform: ruby
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-05-02 00:00:00.000000000 Z
17
+ date: 2024-01-07 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake-compiler
@@ -216,6 +216,7 @@ files:
216
216
  - test/model/shiporder_import.xsd
217
217
  - test/model/soap.xml
218
218
  - test/model/xinclude.xml
219
+ - test/test.rb
219
220
  - test/test_attr.rb
220
221
  - test/test_attr_decl.rb
221
222
  - test/test_attributes.rb
@@ -274,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
275
  - !ruby/object:Gem::Version
275
276
  version: '0'
276
277
  requirements: []
277
- rubygems_version: 3.3.26
278
+ rubygems_version: 3.5.3
278
279
  signing_key:
279
280
  specification_version: 4
280
281
  summary: Ruby Bindings for LibXML2