libxml-ruby 3.0.0 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/HISTORY +37 -0
  3. data/MANIFEST +34 -34
  4. data/README.rdoc +65 -36
  5. data/Rakefile +21 -3
  6. data/ext/libxml/extconf.rb +30 -26
  7. data/ext/libxml/ruby_libxml.h +0 -8
  8. data/ext/libxml/ruby_xml.c +40 -0
  9. data/ext/libxml/ruby_xml_document.c +1 -5
  10. data/ext/libxml/ruby_xml_dtd.c +6 -8
  11. data/ext/libxml/ruby_xml_encoding.c +1 -13
  12. data/ext/libxml/ruby_xml_encoding.h +0 -3
  13. data/ext/libxml/ruby_xml_error.c +1 -1
  14. data/ext/libxml/ruby_xml_error.h +1 -1
  15. data/ext/libxml/ruby_xml_io.c +14 -18
  16. data/ext/libxml/ruby_xml_io.h +1 -1
  17. data/ext/libxml/ruby_xml_node.c +16 -17
  18. data/ext/libxml/ruby_xml_parser_context.c +1 -1
  19. data/ext/libxml/ruby_xml_reader.c +7 -2
  20. data/ext/libxml/ruby_xml_schema.c +44 -66
  21. data/ext/libxml/ruby_xml_schema_element.c +15 -14
  22. data/ext/libxml/ruby_xml_schema_type.c +66 -93
  23. data/ext/libxml/ruby_xml_version.h +4 -4
  24. data/ext/libxml/ruby_xml_writer.c +189 -192
  25. data/lib/libxml/schema/element.rb +0 -8
  26. data/lib/libxml/schema/type.rb +0 -8
  27. data/lib/libxml/schema.rb +0 -19
  28. data/lib/libxml-ruby.rb +30 -0
  29. data/lib/libxml.rb +3 -28
  30. data/libxml-ruby.gemspec +5 -4
  31. data/setup.rb +0 -1
  32. data/test/model/cwm_1_0.xml +11336 -0
  33. data/test/{tc_attr.rb → test_attr.rb} +18 -18
  34. data/test/{tc_attr_decl.rb → test_attr_decl.rb} +8 -8
  35. data/test/{tc_attributes.rb → test_attributes.rb} +10 -10
  36. data/test/{tc_canonicalize.rb → test_canonicalize.rb} +35 -39
  37. data/test/test_deprecated_require.rb +12 -0
  38. data/test/{tc_document.rb → test_document.rb} +31 -24
  39. data/test/test_document_write.rb +146 -0
  40. data/test/{tc_dtd.rb → test_dtd.rb} +26 -25
  41. data/test/{tc_encoding.rb → test_encoding.rb} +20 -17
  42. data/test/{tc_encoding_sax.rb → test_encoding_sax.rb} +3 -3
  43. data/test/test_error.rb +178 -0
  44. data/test/test_helper.rb +4 -11
  45. data/test/{tc_html_parser.rb → test_html_parser.rb} +31 -30
  46. data/test/test_html_parser_context.rb +23 -0
  47. data/test/test_namespace.rb +60 -0
  48. data/test/{tc_namespaces.rb → test_namespaces.rb} +29 -38
  49. data/test/{tc_node.rb → test_node.rb} +37 -31
  50. data/test/{tc_node_cdata.rb → test_node_cdata.rb} +10 -10
  51. data/test/{tc_node_comment.rb → test_node_comment.rb} +6 -6
  52. data/test/{tc_node_copy.rb → test_node_copy.rb} +3 -4
  53. data/test/{tc_node_edit.rb → test_node_edit.rb} +20 -21
  54. data/test/{tc_node_pi.rb → test_node_pi.rb} +8 -10
  55. data/test/{tc_node_text.rb → test_node_text.rb} +8 -9
  56. data/test/{tc_node_write.rb → test_node_write.rb} +16 -26
  57. data/test/test_node_xlink.rb +28 -0
  58. data/test/{tc_parser.rb → test_parser.rb} +72 -75
  59. data/test/{tc_parser_context.rb → test_parser_context.rb} +38 -44
  60. data/test/{tc_properties.rb → test_properties.rb} +5 -5
  61. data/test/test_reader.rb +364 -0
  62. data/test/{tc_relaxng.rb → test_relaxng.rb} +11 -11
  63. data/test/{tc_sax_parser.rb → test_sax_parser.rb} +38 -31
  64. data/test/{tc_schema.rb → test_schema.rb} +40 -33
  65. data/test/test_suite.rb +39 -40
  66. data/test/{tc_traversal.rb → test_traversal.rb} +4 -4
  67. data/test/{tc_writer.rb → test_writer.rb} +95 -74
  68. data/test/{tc_xinclude.rb → test_xinclude.rb} +3 -3
  69. data/test/test_xml.rb +263 -0
  70. data/test/{tc_xpath.rb → test_xpath.rb} +25 -25
  71. data/test/{tc_xpath_context.rb → test_xpath_context.rb} +5 -5
  72. data/test/{tc_xpath_expression.rb → test_xpath_expression.rb} +7 -7
  73. data/test/{tc_xpointer.rb → test_xpointer.rb} +15 -15
  74. metadata +91 -102
  75. data/test/tc_deprecated_require.rb +0 -12
  76. data/test/tc_document_write.rb +0 -195
  77. data/test/tc_error.rb +0 -178
  78. data/test/tc_html_parser_context.rb +0 -23
  79. data/test/tc_namespace.rb +0 -61
  80. data/test/tc_node_xlink.rb +0 -28
  81. data/test/tc_reader.rb +0 -358
  82. data/test/tc_xml.rb +0 -225
data/test/tc_reader.rb DELETED
@@ -1,358 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require './test_helper'
4
- require 'stringio'
5
-
6
- class TestReader < Minitest::Test
7
- XML_FILE = File.join(File.dirname(__FILE__), 'model/atom.xml')
8
-
9
- def verify_simple(reader)
10
- node_types = []
11
-
12
- # Read each node
13
- 26.times do
14
- assert(reader.read)
15
- node_types << reader.node_type
16
- end
17
-
18
- # There are no more nodes
19
- assert(!reader.read)
20
-
21
- # Check what was read
22
- expected = [XML::Reader::TYPE_PROCESSING_INSTRUCTION,
23
- XML::Reader::TYPE_ELEMENT,
24
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
25
- XML::Reader::TYPE_COMMENT,
26
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
27
- XML::Reader::TYPE_ELEMENT,
28
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
29
- XML::Reader::TYPE_ELEMENT,
30
- XML::Reader::TYPE_CDATA,
31
- XML::Reader::TYPE_END_ELEMENT,
32
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
33
- XML::Reader::TYPE_ELEMENT,
34
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
35
- XML::Reader::TYPE_ELEMENT,
36
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
37
- XML::Reader::TYPE_ELEMENT,
38
- XML::Reader::TYPE_TEXT,
39
- XML::Reader::TYPE_END_ELEMENT,
40
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
41
- XML::Reader::TYPE_END_ELEMENT,
42
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
43
- XML::Reader::TYPE_END_ELEMENT,
44
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
45
- XML::Reader::TYPE_END_ELEMENT,
46
- XML::Reader::TYPE_SIGNIFICANT_WHITESPACE,
47
- XML::Reader::TYPE_END_ELEMENT]
48
-
49
- assert_equal(expected, node_types)
50
- end
51
-
52
- def test_document
53
- reader = XML::Reader.document(XML::Document.file(XML_FILE))
54
- verify_simple(reader)
55
- end
56
-
57
- def test_file
58
- reader = XML::Reader.file(XML_FILE)
59
- verify_simple(reader)
60
- end
61
-
62
- def test_invalid_file
63
- assert_raises(XML::Error) do
64
- XML::Reader.file('/does/not/exist')
65
- end
66
- end
67
-
68
- def test_string
69
- reader = XML::Reader.string(File.read(XML_FILE))
70
- verify_simple(reader)
71
- end
72
-
73
- def test_io
74
- File.open(XML_FILE, 'rb') do |io|
75
- reader = XML::Reader.io(io)
76
- verify_simple(reader)
77
- end
78
- end
79
-
80
- def test_io_gc
81
- # Test that the reader keeps a reference
82
- # to the io object
83
- file = File.open(XML_FILE, 'rb')
84
- reader = XML::Reader.io(file)
85
- file = nil
86
- GC.start
87
- assert(reader.read)
88
- end
89
-
90
- def test_string_io
91
- data = File.read(XML_FILE)
92
- string_io = StringIO.new(data)
93
- reader = XML::Reader.io(string_io)
94
- verify_simple(reader)
95
- end
96
-
97
- def test_error
98
- reader = XML::Reader.string('<foo blah')
99
-
100
- error = assert_raises(XML::Error) do
101
- reader.read
102
- end
103
- assert_equal("Fatal error: Couldn't find end of Start Tag foo at :1.", error.to_s)
104
- end
105
-
106
- def test_attr
107
- parser = XML::Reader.string("<foo x='1' y='2'/>")
108
- assert(parser.read)
109
- assert_equal('foo', parser.name)
110
- assert_equal('1', parser['x'])
111
- assert_equal('1', parser[0])
112
- assert_equal('2', parser['y'])
113
- assert_equal('2', parser[1])
114
- assert_nil(parser['z'])
115
- assert_nil(parser[2])
116
- end
117
-
118
- def test_move_attr
119
- reader = XML::Reader.string('<root xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml"><link xml:id="abc" xlink:href="def" xhtml:class="ghi" bar="jkl" /></root>')
120
- assert(reader.read) # <root/>
121
- assert(reader.read) # <link/>
122
-
123
- assert(reader.move_to_attribute_no(1))
124
- assert_equal(reader.value, 'def')
125
- assert(reader.move_to_attribute_ns('id', 'http://www.w3.org/XML/1998/namespace'))
126
- assert_equal(reader.value, 'abc')
127
- assert(reader.move_to_attribute('bar'))
128
- assert_equal(reader.value, 'jkl')
129
-
130
- # 1 in case of success, -1 in case of error, 0 if not found
131
- assert_equal(reader.move_to_attribute_no(12), 0)
132
- assert_equal(reader.move_to_attribute('baz'), 0)
133
- assert_equal(reader.move_to_attribute_ns('baz', 'http://ruby/namespace'), 0)
134
- end
135
-
136
- def test_get_attr
137
- reader = XML::Reader.string('<root xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml"><link xml:id="abc" xlink:href="def" xhtml:class="ghi" bar="jkl" /></root>')
138
- assert(reader.read) # <root/>
139
- assert(reader.read) # <link/>
140
-
141
- assert_equal(reader.get_attribute_no(1), 'def')
142
- assert_equal(reader.get_attribute_ns('id', 'http://www.w3.org/XML/1998/namespace'), 'abc')
143
- assert_equal(reader.get_attribute('bar'), 'jkl')
144
-
145
- assert_equal(reader.get_attribute_no(12), nil)
146
- assert_equal(reader.get_attribute('baz'), nil)
147
- assert_equal(reader.get_attribute_ns('baz', 'http://ruby/namespace'), nil)
148
- end
149
-
150
- def test_value
151
- parser = XML::Reader.string("<foo><bar>1</bar><bar>2</bar><bar>3</bar></foo>")
152
- assert(parser.read)
153
- assert_equal('foo', parser.name)
154
- assert_equal(nil, parser.value)
155
- 3.times do |i|
156
- assert(parser.read)
157
- assert_equal(XML::Reader::TYPE_ELEMENT, parser.node_type)
158
- assert_equal('bar', parser.name)
159
- assert(parser.read)
160
- assert_equal(XML::Reader::TYPE_TEXT, parser.node_type)
161
- assert_equal((i + 1).to_s, parser.value)
162
- assert(parser.read)
163
- assert_equal(XML::Reader::TYPE_END_ELEMENT, parser.node_type)
164
- end
165
- end
166
-
167
- def test_expand
168
- reader = XML::Reader.file(XML_FILE)
169
- reader.read.to_s
170
- reader.read
171
-
172
- # Read a node
173
- node = reader.expand
174
- assert_equal('feed', node.name)
175
- assert_equal(::Encoding::UTF_8, node.name.encoding) if defined?(::Encoding)
176
- end
177
-
178
- def test_expand_doc
179
- reader = XML::Reader.file(XML_FILE)
180
- reader.read.to_s
181
- reader.read
182
-
183
- # Read a node
184
- node = reader.expand
185
-
186
- # Try to access the document
187
- refute_nil(node.doc)
188
- end
189
-
190
- def test_expand_find
191
- reader = XML::Reader.file(XML_FILE)
192
- reader.read.to_s
193
- reader.read
194
-
195
- # Read first node which
196
- node = reader.expand
197
- assert_equal('feed', node.name)
198
-
199
- # We need to create document to use xpath
200
- reader.doc
201
-
202
- # Search for entries
203
- entries = node.find('atom:entry', 'atom:http://www.w3.org/2005/Atom')
204
-
205
- assert_equal(1, entries.length)
206
- end
207
-
208
- def test_expand_invalid
209
- reader = XML::Reader.file(XML_FILE)
210
-
211
- # Expand a node before one has been read
212
- node = reader.expand
213
- assert_nil(node)
214
- end
215
-
216
- def test_expand_should_be_invalid
217
- reader = XML::Reader.file(XML_FILE)
218
-
219
- # Read a couple of nodes
220
- reader.read
221
- reader.read
222
-
223
- # Expand the node
224
- node = reader.expand
225
- assert_equal('feed', node.name)
226
-
227
- # Read another node, this makes the last node invalid
228
- reader.next
229
-
230
- # The previous node is now invalid - this should be an error but isn't
231
- assert_equal('feed', node.name)
232
- end
233
-
234
- def test_mode
235
- reader = XML::Reader.string('<xml/>')
236
- assert_equal(XML::Reader::MODE_INITIAL, reader.read_state)
237
- reader.read
238
- assert_equal(XML::Reader::MODE_EOF, reader.read_state)
239
- end
240
-
241
- def test_bytes_consumed
242
- reader = XML::Reader.file(XML_FILE)
243
- reader.read
244
- assert_equal(428, reader.byte_consumed)
245
- end
246
-
247
- def test_node
248
- XML.default_line_numbers = true
249
- reader = XML::Reader.file(XML_FILE)
250
-
251
- # first try to get a node
252
- assert_nil(reader.node)
253
-
254
- reader.read
255
- assert_instance_of(XML::Node, reader.node)
256
- end
257
-
258
- def test_base_uri
259
- # UTF8:
260
- # ö - c3 b6 in hex, \303\266 in octal
261
- # ü - c3 bc in hex, \303\274 in octal
262
- xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><bands genre=\"metal\">\n <m\303\266tley_cr\303\274e country=\"us\">An American heavy metal band formed in Los Angeles, California in 1981.</m\303\266tley_cr\303\274e>\n <iron_maiden country=\"uk\">British heavy metal band formed in 1975.</iron_maiden>\n</bands>"
263
- reader = XML::Reader.string(xml, :base_uri => "http://libxml.rubyforge.org")
264
-
265
- reader.read
266
- assert_equal(reader.base_uri, "http://libxml.rubyforge.org")
267
- assert_equal(::Encoding::UTF_8, reader.base_uri.encoding) if defined?(::Encoding)
268
- end
269
-
270
- def test_options
271
- xml = <<-EOS
272
- <!DOCTYPE foo [<!ENTITY foo 'bar'>]>
273
- <test>
274
- <cdata><![CDATA[something]]></cdata>
275
- <entity>&foo;</entity>
276
- </test>
277
- EOS
278
-
279
- # Parse normally
280
- reader = XML::Reader.string(xml)
281
- reader.read # foo
282
- reader.read # test
283
- reader.read # text
284
- reader.read # cdata
285
- reader.read # cdata-section
286
- assert_equal(XML::Node::CDATA_SECTION_NODE, reader.node_type)
287
-
288
- # Convert cdata section to text
289
- reader = XML::Reader.string(xml, :options => XML::Parser::Options::NOCDATA)
290
- reader.read # foo
291
- reader.read # test
292
- reader.read # text
293
- reader.read # cdata
294
- reader.read # cdata-section
295
- assert_equal(XML::Node::TEXT_NODE, reader.node_type)
296
- end
297
-
298
- def test_encoding
299
- # ISO_8859_1:
300
- # ö - f6 in hex, \366 in octal
301
- # ü - fc in hex, \374 in octal
302
- xml = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><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>"
303
-
304
- reader = XML::Reader.string(xml, :encoding => XML::Encoding::ISO_8859_1)
305
- reader.read
306
-
307
- if defined?(Encoding)
308
- assert_equal(Encoding::ISO8859_1, reader.read_outer_xml.encoding)
309
- assert_equal(Encoding::ISO8859_1, reader.read_inner_xml.encoding)
310
- assert_equal(Encoding::ISO8859_1, reader.read_string.encoding)
311
-
312
- assert_equal("<bands genre=\"metal\">\n <m\xC3\xB6tley_cr\xC3\xBCe country=\"us\">An American heavy metal band formed in Los Angeles, California in 1981.</m\xC3\xB6tley_cr\xC3\xBCe>\n <iron_maiden country=\"uk\">British heavy metal band formed in 1975.</iron_maiden>\n</bands>".force_encoding(Encoding::ISO8859_1),
313
- reader.read_outer_xml)
314
- assert_equal("\n <m\xC3\xB6tley_cr\xC3\xBCe country=\"us\">An American heavy metal band formed in Los Angeles, California in 1981.</m\xC3\xB6tley_cr\xC3\xBCe>\n <iron_maiden country=\"uk\">British heavy metal band formed in 1975.</iron_maiden>\n".force_encoding(Encoding::ISO8859_1),
315
- reader.read_inner_xml)
316
- assert_equal("\n An American heavy metal band formed in Los Angeles, California in 1981.\n British heavy metal band formed in 1975.\n".force_encoding(Encoding::ISO8859_1),
317
- reader.read_string)
318
- else
319
- assert_equal("<bands genre=\"metal\">\n <m\303\266tley_cr\303\274e country=\"us\">An American heavy metal band formed in Los Angeles, California in 1981.</m\303\266tley_cr\303\274e>\n <iron_maiden country=\"uk\">British heavy metal band formed in 1975.</iron_maiden>\n</bands>",
320
- reader.read_outer_xml)
321
- end
322
- end
323
-
324
- def test_invalid_encoding
325
- # ISO_8859_1:
326
- # ö - f6 in hex, \366 in octal
327
- # ü - fc in hex, \374 in octal
328
- 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>"
329
-
330
- reader = XML::Reader.string(xml)
331
- error = assert_raises(XML::Error) do
332
- node = reader.read
333
- end
334
-
335
- assert_equal("Fatal error: Input is not proper UTF-8, indicate encoding !\nBytes: 0xF6 0x74 0x6C 0x65 at :2.",
336
- error.to_s)
337
-
338
- end
339
-
340
- def test_file_encoding
341
- reader = XML::Reader.file(XML_FILE)
342
- reader.read
343
- assert_equal(XML::Encoding::UTF_8, reader.encoding)
344
- assert_equal(Encoding::UTF_8, reader.value.encoding) if defined?(Encoding)
345
- end
346
-
347
- def test_string_encoding
348
- # ISO_8859_1:
349
- # ö - f6 in hex, \366 in octal
350
- # ü - fc in hex, \374 in octal
351
- 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>"
352
- reader = XML::Reader.string(xml, :encoding => XML::Encoding::ISO_8859_1)
353
- reader.read
354
-
355
- # Encoding is always null for strings, very annoying!
356
- assert_equal(reader.encoding, XML::Encoding::NONE)
357
- end
358
- end
data/test/tc_xml.rb DELETED
@@ -1,225 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require './test_helper'
4
- require 'stringio'
5
-
6
- class TestXml < Minitest::Test
7
- # ----- Constants ------
8
- def test_lib_versions
9
- assert(XML.check_lib_versions)
10
- end
11
-
12
- def test_debug_entities
13
- XML.debug_entities = false
14
- assert(!XML.debug_entities)
15
-
16
- XML.debug_entities = true
17
- assert(XML.debug_entities)
18
-
19
- XML.debug_entities = false
20
- assert(!XML.debug_entities)
21
- end
22
-
23
- def test_default_compression
24
- return unless XML.default_compression
25
-
26
- 0.upto(9) do |i|
27
- XML.default_compression = i
28
- assert_equal(i, XML.default_compression)
29
- end
30
-
31
- 9.downto(0) do |i|
32
- assert_equal(i, XML.default_compression = i)
33
- assert_equal(i, XML.default_compression)
34
- end
35
-
36
- 0.downto(-10) do |i|
37
- assert_equal(i, XML.default_compression = i)
38
- assert_equal(0, XML.default_compression)
39
- end
40
-
41
- 10.upto(20) do |i|
42
- assert_equal(i, XML.default_compression = i)
43
- assert_equal(9, XML.default_compression)
44
- end
45
- end
46
-
47
- def test_default_keep_blanks
48
- XML.default_keep_blanks = false
49
- assert(!XML.default_keep_blanks)
50
- assert_equal(XML::Parser::Options::NOBLANKS, XML.default_options)
51
-
52
- XML.default_keep_blanks = true
53
- assert(XML.default_keep_blanks)
54
- assert_equal(0, XML.default_options)
55
-
56
- XML.default_keep_blanks = false
57
- assert(!XML.default_keep_blanks)
58
-
59
- # other tests depend on keeping blanks by default,
60
- # which is the default default behaviour anyway.
61
- XML.default_keep_blanks = true
62
- end
63
-
64
- def test_default_line_numbers
65
- XML.default_line_numbers = false
66
- assert(!XML.default_line_numbers)
67
-
68
- XML.default_line_numbers = true
69
- assert(XML.default_line_numbers)
70
-
71
- XML.default_line_numbers = false
72
- assert(!XML.default_line_numbers)
73
- end
74
-
75
- def test_default_substitute_entities
76
- XML.default_substitute_entities = false
77
- assert(!XML.default_substitute_entities)
78
- assert_equal(0, XML.default_options)
79
-
80
- XML.default_substitute_entities = true
81
- assert(XML.default_substitute_entities)
82
- assert_equal(XML::Parser::Options::NOENT, XML.default_options)
83
-
84
- XML.default_substitute_entities = false
85
- assert(!XML.default_substitute_entities)
86
- end
87
-
88
- def test_default_tree_indent_string
89
- s = XML.default_tree_indent_string
90
- assert_instance_of(String, s)
91
- assert_equal(' ', s)
92
- XML.default_tree_indent_string = 'uga'
93
- s = XML.default_tree_indent_string
94
- assert_instance_of(String, s)
95
- assert_equal('uga', s)
96
- XML.default_tree_indent_string = ' '
97
- s = XML.default_tree_indent_string
98
- assert_instance_of(String, s)
99
- assert_equal(' ', s)
100
- end
101
-
102
- def test_default_validity_checking
103
- XML.default_validity_checking = false
104
- assert(!XML.default_validity_checking)
105
- assert_equal(0, XML.default_options)
106
-
107
- XML.default_validity_checking = true
108
- assert(XML.default_validity_checking)
109
- assert_equal(XML::Parser::Options::DTDVALID, XML.default_options)
110
-
111
- XML.default_validity_checking = false
112
- assert(!XML.default_validity_checking)
113
- end
114
-
115
- def test_default_warnings
116
- XML.default_warnings = false
117
- assert(!XML.default_warnings)
118
- assert_equal(XML::Parser::Options::NOWARNING, XML.default_options)
119
-
120
- XML.default_warnings = true
121
- assert(XML.default_warnings)
122
- assert_equal(0, XML.default_options)
123
-
124
- XML.default_warnings = false
125
- assert(!XML.default_warnings)
126
- end
127
-
128
- def test_enabled_automata
129
- assert_equal(true, XML.enabled_automata?)
130
- end
131
-
132
- def test_enabled_c14n
133
- assert_equal(true, XML.enabled_c14n?)
134
- end
135
-
136
- def test_enabled_catalog
137
- assert_equal(true, XML.enabled_catalog?)
138
- end
139
-
140
- def test_enabled_debug
141
- assert_equal(true, XML.enabled_debug?)
142
- end
143
-
144
- def test_enabled_docbook
145
- assert_equal(true, XML.enabled_docbook?)
146
- end
147
-
148
- def test_enabled_ftp
149
- assert_equal(true, XML.enabled_ftp?)
150
- end
151
-
152
- def test_enabled_http
153
- assert_equal(true, XML.enabled_http?)
154
- end
155
-
156
- def test_enabled_html
157
- assert_equal(true, XML.enabled_html?)
158
- end
159
-
160
- def test_enabled_iconv
161
- assert_equal(true, XML.enabled_iconv?)
162
- end
163
-
164
- def test_enabled_memory_debug
165
- assert_equal(false, XML.enabled_memory_debug?)
166
- end
167
-
168
- def test_enabled_regexp
169
- assert_equal(true, XML.enabled_regexp?)
170
- end
171
-
172
- def test_enabled_schemas
173
- assert_equal(true, XML.enabled_schemas?)
174
- end
175
-
176
- def test_enabled_thread
177
- assert_equal(true, XML.enabled_thread?)
178
- end
179
-
180
- def test_enabled_unicode
181
- assert_equal(true, XML.enabled_unicode?)
182
- end
183
-
184
- def test_enabled_xinclude
185
- assert_equal(true, XML.enabled_xinclude?)
186
- end
187
-
188
- def test_enabled_xpath
189
- assert_equal(true, XML.enabled_xpath?)
190
- end
191
-
192
- def test_enabled_xpointer
193
- assert_equal(true, XML.enabled_xpointer?)
194
- end
195
-
196
- def test_enabled_zlib
197
- assert_equal(true, XML.enabled_zlib?)
198
- end
199
-
200
- def test_intent_tree_output
201
- assert(TrueClass, XML.indent_tree_output)
202
-
203
- XML.indent_tree_output = false
204
- assert(FalseClass, XML.indent_tree_output)
205
-
206
- XML.indent_tree_output = true
207
- assert(TrueClass, XML.indent_tree_output)
208
- end
209
-
210
- def test_version
211
- assert_instance_of(String, XML::VERSION)
212
- end
213
-
214
- def test_vernum
215
- assert_instance_of(Fixnum, XML::VERNUM)
216
- end
217
-
218
- def test_libxml_parser_features
219
- assert_instance_of(Array, XML.features)
220
- end
221
-
222
- def test_default_options
223
- assert_equal(0, XML.default_options)
224
- end
225
- end