libxml-ruby 2.0.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HISTORY +516 -0
- data/LICENSE +23 -0
- data/MANIFEST +165 -0
- data/README.rdoc +161 -0
- data/Rakefile +82 -0
- data/ext/libxml/extconf.rb +122 -0
- data/ext/libxml/libxml.c +93 -0
- data/ext/libxml/ruby_libxml.h +101 -0
- data/ext/libxml/ruby_xml.c +893 -0
- data/ext/libxml/ruby_xml.h +10 -0
- data/ext/libxml/ruby_xml_attr.c +352 -0
- data/ext/libxml/ruby_xml_attr.h +14 -0
- data/ext/libxml/ruby_xml_attr_decl.c +171 -0
- data/ext/libxml/ruby_xml_attr_decl.h +13 -0
- data/ext/libxml/ruby_xml_attributes.c +277 -0
- data/ext/libxml/ruby_xml_attributes.h +17 -0
- data/ext/libxml/ruby_xml_cbg.c +85 -0
- data/ext/libxml/ruby_xml_document.c +958 -0
- data/ext/libxml/ruby_xml_document.h +17 -0
- data/ext/libxml/ruby_xml_dtd.c +257 -0
- data/ext/libxml/ruby_xml_dtd.h +9 -0
- data/ext/libxml/ruby_xml_encoding.c +221 -0
- data/ext/libxml/ruby_xml_encoding.h +16 -0
- data/ext/libxml/ruby_xml_error.c +1004 -0
- data/ext/libxml/ruby_xml_error.h +14 -0
- data/ext/libxml/ruby_xml_html_parser.c +92 -0
- data/ext/libxml/ruby_xml_html_parser.h +12 -0
- data/ext/libxml/ruby_xml_html_parser_context.c +308 -0
- data/ext/libxml/ruby_xml_html_parser_context.h +12 -0
- data/ext/libxml/ruby_xml_html_parser_options.c +40 -0
- data/ext/libxml/ruby_xml_html_parser_options.h +12 -0
- data/ext/libxml/ruby_xml_input_cbg.c +191 -0
- data/ext/libxml/ruby_xml_input_cbg.h +20 -0
- data/ext/libxml/ruby_xml_io.c +30 -0
- data/ext/libxml/ruby_xml_io.h +9 -0
- data/ext/libxml/ruby_xml_namespace.c +170 -0
- data/ext/libxml/ruby_xml_namespace.h +12 -0
- data/ext/libxml/ruby_xml_namespaces.c +295 -0
- data/ext/libxml/ruby_xml_namespaces.h +11 -0
- data/ext/libxml/ruby_xml_node.c +1386 -0
- data/ext/libxml/ruby_xml_node.h +13 -0
- data/ext/libxml/ruby_xml_parser.c +94 -0
- data/ext/libxml/ruby_xml_parser.h +14 -0
- data/ext/libxml/ruby_xml_parser_context.c +982 -0
- data/ext/libxml/ruby_xml_parser_context.h +12 -0
- data/ext/libxml/ruby_xml_parser_options.c +68 -0
- data/ext/libxml/ruby_xml_parser_options.h +14 -0
- data/ext/libxml/ruby_xml_reader.c +1057 -0
- data/ext/libxml/ruby_xml_reader.h +14 -0
- data/ext/libxml/ruby_xml_relaxng.c +111 -0
- data/ext/libxml/ruby_xml_relaxng.h +10 -0
- data/ext/libxml/ruby_xml_sax2_handler.c +334 -0
- data/ext/libxml/ruby_xml_sax2_handler.h +12 -0
- data/ext/libxml/ruby_xml_sax_parser.c +136 -0
- data/ext/libxml/ruby_xml_sax_parser.h +12 -0
- data/ext/libxml/ruby_xml_schema.c +159 -0
- data/ext/libxml/ruby_xml_schema.h +11 -0
- data/ext/libxml/ruby_xml_version.h +9 -0
- data/ext/libxml/ruby_xml_xinclude.c +18 -0
- data/ext/libxml/ruby_xml_xinclude.h +13 -0
- data/ext/libxml/ruby_xml_xpath.c +107 -0
- data/ext/libxml/ruby_xml_xpath.h +12 -0
- data/ext/libxml/ruby_xml_xpath_context.c +390 -0
- data/ext/libxml/ruby_xml_xpath_context.h +11 -0
- data/ext/libxml/ruby_xml_xpath_expression.c +83 -0
- data/ext/libxml/ruby_xml_xpath_expression.h +12 -0
- data/ext/libxml/ruby_xml_xpath_object.c +336 -0
- data/ext/libxml/ruby_xml_xpath_object.h +19 -0
- data/ext/libxml/ruby_xml_xpointer.c +101 -0
- data/ext/libxml/ruby_xml_xpointer.h +13 -0
- data/ext/mingw/Rakefile +34 -0
- data/ext/mingw/build.rake +41 -0
- data/ext/vc/libxml_ruby.sln +26 -0
- data/lib/1.8/libxml_ruby.so +0 -0
- data/lib/1.9/libxml_ruby.so +0 -0
- data/lib/libxml.rb +30 -0
- data/lib/libxml/attr.rb +113 -0
- data/lib/libxml/attr_decl.rb +80 -0
- data/lib/libxml/attributes.rb +14 -0
- data/lib/libxml/document.rb +192 -0
- data/lib/libxml/error.rb +90 -0
- data/lib/libxml/hpricot.rb +78 -0
- data/lib/libxml/html_parser.rb +96 -0
- data/lib/libxml/namespace.rb +62 -0
- data/lib/libxml/namespaces.rb +38 -0
- data/lib/libxml/node.rb +399 -0
- data/lib/libxml/ns.rb +22 -0
- data/lib/libxml/parser.rb +367 -0
- data/lib/libxml/properties.rb +23 -0
- data/lib/libxml/reader.rb +29 -0
- data/lib/libxml/sax_callbacks.rb +180 -0
- data/lib/libxml/sax_parser.rb +58 -0
- data/lib/libxml/tree.rb +29 -0
- data/lib/libxml/xpath_object.rb +16 -0
- data/lib/xml.rb +16 -0
- data/lib/xml/libxml.rb +10 -0
- data/libxml-ruby.gemspec +50 -0
- data/script/benchmark/depixelate +634 -0
- data/script/benchmark/hamlet.xml +9055 -0
- data/script/benchmark/parsecount +170 -0
- data/script/benchmark/sock_entries.xml +507 -0
- data/script/benchmark/throughput +41 -0
- data/script/test +6 -0
- data/setup.rb +1585 -0
- data/test/etc_doc_to_s.rb +21 -0
- data/test/ets_doc_file.rb +17 -0
- data/test/ets_doc_to_s.rb +23 -0
- data/test/ets_gpx.rb +28 -0
- data/test/ets_node_gc.rb +23 -0
- data/test/ets_test.xml +2 -0
- data/test/ets_tsr.rb +11 -0
- data/test/model/atom.xml +13 -0
- data/test/model/bands.iso-8859-1.xml +5 -0
- data/test/model/bands.utf-8.xml +5 -0
- data/test/model/bands.xml +5 -0
- data/test/model/books.xml +146 -0
- data/test/model/merge_bug_data.xml +58 -0
- data/test/model/ruby-lang.html +238 -0
- data/test/model/rubynet.xml +79 -0
- data/test/model/rubynet_project +1 -0
- data/test/model/shiporder.rnc +28 -0
- data/test/model/shiporder.rng +86 -0
- data/test/model/shiporder.xml +23 -0
- data/test/model/shiporder.xsd +31 -0
- data/test/model/soap.xml +27 -0
- data/test/model/xinclude.xml +5 -0
- data/test/rb-magic-comment.rb +33 -0
- data/test/tc_attr.rb +181 -0
- data/test/tc_attr_decl.rb +133 -0
- data/test/tc_attributes.rb +135 -0
- data/test/tc_deprecated_require.rb +13 -0
- data/test/tc_document.rb +119 -0
- data/test/tc_document_write.rb +187 -0
- data/test/tc_dtd.rb +125 -0
- data/test/tc_error.rb +138 -0
- data/test/tc_html_parser.rb +140 -0
- data/test/tc_namespace.rb +62 -0
- data/test/tc_namespaces.rb +177 -0
- data/test/tc_node.rb +258 -0
- data/test/tc_node_cdata.rb +51 -0
- data/test/tc_node_comment.rb +33 -0
- data/test/tc_node_copy.rb +42 -0
- data/test/tc_node_edit.rb +160 -0
- data/test/tc_node_text.rb +71 -0
- data/test/tc_node_write.rb +108 -0
- data/test/tc_node_xlink.rb +29 -0
- data/test/tc_parser.rb +336 -0
- data/test/tc_parser_context.rb +189 -0
- data/test/tc_properties.rb +39 -0
- data/test/tc_reader.rb +298 -0
- data/test/tc_relaxng.rb +54 -0
- data/test/tc_sax_parser.rb +276 -0
- data/test/tc_schema.rb +53 -0
- data/test/tc_traversal.rb +222 -0
- data/test/tc_xinclude.rb +21 -0
- data/test/tc_xml.rb +226 -0
- data/test/tc_xpath.rb +195 -0
- data/test/tc_xpath_context.rb +80 -0
- data/test/tc_xpath_expression.rb +38 -0
- data/test/tc_xpointer.rb +74 -0
- data/test/test_helper.rb +14 -0
- data/test/test_suite.rb +39 -0
- metadata +254 -0
data/test/tc_schema.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require './test_helper'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestSchema < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
file = File.join(File.dirname(__FILE__), 'model/shiporder.xml')
|
9
|
+
@doc = XML::Document.file(file)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
@doc = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def schema
|
17
|
+
document = XML::Document.file(File.join(File.dirname(__FILE__), 'model/shiporder.xsd'))
|
18
|
+
schema = XML::Schema.document(document)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_from_doc
|
22
|
+
assert_instance_of(XML::Schema, schema)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_valid
|
26
|
+
assert(@doc.validate_schema(schema))
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_invalid
|
30
|
+
new_node = XML::Node.new('invalid', 'this will mess up validation')
|
31
|
+
@doc.root << new_node
|
32
|
+
|
33
|
+
error = assert_raise(XML::Error) do
|
34
|
+
@doc.validate_schema(schema)
|
35
|
+
end
|
36
|
+
|
37
|
+
assert_not_nil(error)
|
38
|
+
assert_kind_of(XML::Error, error)
|
39
|
+
assert(error.message.match(/Error: Element 'invalid': This element is not expected. Expected is \( item \)/))
|
40
|
+
assert_equal(XML::Error::SCHEMASV, error.domain)
|
41
|
+
assert_equal(XML::Error::SCHEMAV_ELEMENT_CONTENT, error.code)
|
42
|
+
assert_equal(XML::Error::ERROR, error.level)
|
43
|
+
assert(error.file.match(/shiporder.xml/))
|
44
|
+
assert_nil(error.line)
|
45
|
+
assert_nil(error.str1)
|
46
|
+
assert_nil(error.str2)
|
47
|
+
assert_nil(error.str3)
|
48
|
+
assert_equal(0, error.int1)
|
49
|
+
assert_equal(0, error.int2)
|
50
|
+
assert_not_nil(error.node)
|
51
|
+
assert_equal('invalid', error.node.name)
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,222 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require './test_helper'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestTranversal < Test::Unit::TestCase
|
7
|
+
ROOT_NODES_LENGTH = 25
|
8
|
+
ROOT_ELEMENTS_LENGTH = 12
|
9
|
+
|
10
|
+
def setup
|
11
|
+
filename = File.join(File.dirname(__FILE__), 'model/books.xml')
|
12
|
+
@doc = XML::Document.file(filename)
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
@doc = nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_children
|
20
|
+
# Includes text nodes and such
|
21
|
+
assert_equal(ROOT_NODES_LENGTH, @doc.root.children.length)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_children_iteration
|
25
|
+
# Includes text nodes and such
|
26
|
+
nodes = @doc.root.children.inject([]) do |arr, node|
|
27
|
+
arr << node
|
28
|
+
arr
|
29
|
+
end
|
30
|
+
|
31
|
+
assert_equal(ROOT_NODES_LENGTH, nodes.length)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_each
|
35
|
+
# Includes text nodes and such
|
36
|
+
nodes = @doc.root.inject([]) do |arr, node|
|
37
|
+
arr << node
|
38
|
+
arr
|
39
|
+
end
|
40
|
+
|
41
|
+
assert_equal(ROOT_NODES_LENGTH, nodes.length)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_each_element
|
45
|
+
# Includes text nodes and such
|
46
|
+
nodes = []
|
47
|
+
@doc.root.each_element do |node|
|
48
|
+
nodes << node
|
49
|
+
end
|
50
|
+
|
51
|
+
assert_equal(ROOT_ELEMENTS_LENGTH, nodes.length)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_next
|
55
|
+
nodes = []
|
56
|
+
|
57
|
+
node = @doc.root.first
|
58
|
+
|
59
|
+
while node
|
60
|
+
nodes << node
|
61
|
+
node = node.next
|
62
|
+
end
|
63
|
+
assert_equal(ROOT_NODES_LENGTH, nodes.length)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_next?
|
67
|
+
first_node = @doc.root.first
|
68
|
+
assert(first_node.next?)
|
69
|
+
|
70
|
+
last_node = @doc.root.last
|
71
|
+
assert(!last_node.next?)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_prev
|
75
|
+
nodes = []
|
76
|
+
|
77
|
+
node = @doc.root.last
|
78
|
+
|
79
|
+
while node
|
80
|
+
nodes << node
|
81
|
+
node = node.prev
|
82
|
+
end
|
83
|
+
assert_equal(ROOT_NODES_LENGTH, nodes.length)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_prev?
|
87
|
+
first_node = @doc.root.first
|
88
|
+
assert(!first_node.prev?)
|
89
|
+
|
90
|
+
last_node = @doc.root.last
|
91
|
+
assert(last_node.prev?)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_parent?
|
95
|
+
assert(!@doc.parent?)
|
96
|
+
assert(@doc.root.parent?)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_child?
|
100
|
+
assert(@doc.child?)
|
101
|
+
assert(!@doc.root.first.child?)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_next_prev_equivalence
|
105
|
+
next_nodes = []
|
106
|
+
last_nodes = []
|
107
|
+
|
108
|
+
node = @doc.root.first
|
109
|
+
while node
|
110
|
+
next_nodes << node
|
111
|
+
node = node.next
|
112
|
+
end
|
113
|
+
|
114
|
+
node = @doc.root.last
|
115
|
+
while node
|
116
|
+
last_nodes << node
|
117
|
+
node = node.prev
|
118
|
+
end
|
119
|
+
|
120
|
+
assert_equal(next_nodes, last_nodes.reverse)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_next_children_equivalence
|
124
|
+
next_nodes = []
|
125
|
+
|
126
|
+
node = @doc.root.first
|
127
|
+
while node
|
128
|
+
next_nodes << node
|
129
|
+
node = node.next
|
130
|
+
end
|
131
|
+
|
132
|
+
assert_equal(@doc.root.children, next_nodes)
|
133
|
+
end
|
134
|
+
|
135
|
+
# node = @doc.find_first('book')
|
136
|
+
# node.children.each do |node|
|
137
|
+
# puts 1
|
138
|
+
#end
|
139
|
+
# @doc.root.children do |node|
|
140
|
+
# if node.node_type == XML::Node::ELEMENT_NODE
|
141
|
+
# puts node.name
|
142
|
+
#end
|
143
|
+
#end
|
144
|
+
#assert_equal(12,nodes.length)
|
145
|
+
#end
|
146
|
+
|
147
|
+
#def test_doc_class
|
148
|
+
#assert_instance_of(XML::Document, @doc)
|
149
|
+
#end
|
150
|
+
|
151
|
+
#def test_root_class
|
152
|
+
#assert_instance_of(XML::Node, @doc.root)
|
153
|
+
#end
|
154
|
+
|
155
|
+
#def test_node_class
|
156
|
+
#for n in nodes
|
157
|
+
#assert_instance_of(XML::Node, n)
|
158
|
+
#end
|
159
|
+
#end
|
160
|
+
|
161
|
+
#def test_find_class
|
162
|
+
#set = @doc.find('/ruby_array/fixnum')
|
163
|
+
#assert_instance_of(XML::XPath::Object, set)
|
164
|
+
#end
|
165
|
+
|
166
|
+
#def test_node_child_get
|
167
|
+
#assert_instance_of(TrueClass, @doc.root.child?)
|
168
|
+
#assert_instance_of(XML::Node, @doc.root.child)
|
169
|
+
#assert_equal('fixnum', @doc.root.child.name)
|
170
|
+
#end
|
171
|
+
|
172
|
+
#def test_node_doc
|
173
|
+
#for n in nodes
|
174
|
+
#assert_instance_of(XML::Document, n.doc) if n.document?
|
175
|
+
#end
|
176
|
+
#end
|
177
|
+
|
178
|
+
#def test_node_type_name
|
179
|
+
#assert_equal('element', nodes[0].node_type_name)
|
180
|
+
#assert_equal('element', nodes[1].node_type_name)
|
181
|
+
#end
|
182
|
+
|
183
|
+
#def test_node_find
|
184
|
+
#set = @doc.root.find('./fixnum').set
|
185
|
+
#assert_instance_of(XML::Node::Set, set)
|
186
|
+
#for node in set
|
187
|
+
#assert_instance_of(XML::Node, node)
|
188
|
+
#end
|
189
|
+
#end
|
190
|
+
|
191
|
+
#def test_equality
|
192
|
+
#node_a = @doc.find('/ruby_array/fixnum').first
|
193
|
+
#node_b = @doc.root.child
|
194
|
+
#assert(node_a == node_b)
|
195
|
+
#assert(node_a.eql?(node_b))
|
196
|
+
#assert(node_a.equal?(node_b))
|
197
|
+
|
198
|
+
#xp2 = XML::Parser.new()
|
199
|
+
#xp2.string = '<ruby_array uga="booga" foo="bar"><fixnum>one</fixnum><fixnum>two</fixnum></ruby_array>'
|
200
|
+
#doc2 = xp2.parse
|
201
|
+
|
202
|
+
#node_a2 = doc2.find('/ruby_array/fixnum').first
|
203
|
+
|
204
|
+
#assert(node_a.to_s == node_a2.to_s)
|
205
|
+
#assert(node_a == node_a2)
|
206
|
+
#assert(node_a.eql?(node_a2))
|
207
|
+
#assert(!node_a.equal?(node_a2))
|
208
|
+
#end
|
209
|
+
|
210
|
+
#def test_content()
|
211
|
+
#assert_equal('onetwo', @doc.root.content)
|
212
|
+
|
213
|
+
#first = @doc.root.child
|
214
|
+
#assert_equal('one', first.content)
|
215
|
+
#assert_equal('two', first.next.content)
|
216
|
+
#end
|
217
|
+
|
218
|
+
#def test_base
|
219
|
+
#doc = XML::Parser.string('<person />').parse
|
220
|
+
#assert_nil(doc.root.base)
|
221
|
+
#end
|
222
|
+
end
|
data/test/tc_xinclude.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require './test_helper'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestXInclude < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
@doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/xinclude.xml'))
|
9
|
+
assert_instance_of(XML::Document, @doc)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
@doc = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_ruby_xml_xinclude
|
17
|
+
assert_equal(1, @doc.xinclude)
|
18
|
+
assert_equal("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n <p>This libxml2 binding has the following project information:\n <code>This is some text to include in an xml file via XInclude.</code></p>\n</document>\n",
|
19
|
+
@doc.to_s)
|
20
|
+
end
|
21
|
+
end
|
data/test/tc_xml.rb
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require './test_helper'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
class TestXml < Test::Unit::TestCase
|
8
|
+
# ----- Constants ------
|
9
|
+
def test_lib_versions
|
10
|
+
assert(XML.check_lib_versions)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_debug_entities
|
14
|
+
XML.debug_entities = false
|
15
|
+
assert(!XML.debug_entities)
|
16
|
+
|
17
|
+
XML.debug_entities = true
|
18
|
+
assert(XML.debug_entities)
|
19
|
+
|
20
|
+
XML.debug_entities = false
|
21
|
+
assert(!XML.debug_entities)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_default_compression
|
25
|
+
return unless XML.default_compression
|
26
|
+
|
27
|
+
0.upto(9) do |i|
|
28
|
+
XML.default_compression = i
|
29
|
+
assert_equal(i, XML.default_compression)
|
30
|
+
end
|
31
|
+
|
32
|
+
9.downto(0) do |i|
|
33
|
+
assert_equal(i, XML.default_compression = i)
|
34
|
+
assert_equal(i, XML.default_compression)
|
35
|
+
end
|
36
|
+
|
37
|
+
0.downto(-10) do |i|
|
38
|
+
assert_equal(i, XML.default_compression = i)
|
39
|
+
assert_equal(0, XML.default_compression)
|
40
|
+
end
|
41
|
+
|
42
|
+
10.upto(20) do |i|
|
43
|
+
assert_equal(i, XML.default_compression = i)
|
44
|
+
assert_equal(9, XML.default_compression)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_default_keep_blanks
|
49
|
+
XML.default_keep_blanks = false
|
50
|
+
assert(!XML.default_keep_blanks)
|
51
|
+
assert_equal(XML::Parser::Options::NOBLANKS, XML.default_options)
|
52
|
+
|
53
|
+
XML.default_keep_blanks = true
|
54
|
+
assert(XML.default_keep_blanks)
|
55
|
+
assert_equal(0, XML.default_options)
|
56
|
+
|
57
|
+
XML.default_keep_blanks = false
|
58
|
+
assert(!XML.default_keep_blanks)
|
59
|
+
|
60
|
+
# other tests depend on keeping blanks by default,
|
61
|
+
# which is the default default behaviour anyway.
|
62
|
+
XML.default_keep_blanks = true
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_default_line_numbers
|
66
|
+
XML.default_line_numbers = false
|
67
|
+
assert(!XML.default_line_numbers)
|
68
|
+
|
69
|
+
XML.default_line_numbers = true
|
70
|
+
assert(XML.default_line_numbers)
|
71
|
+
|
72
|
+
XML.default_line_numbers = false
|
73
|
+
assert(!XML.default_line_numbers)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_default_substitute_entities
|
77
|
+
XML.default_substitute_entities = false
|
78
|
+
assert(!XML.default_substitute_entities)
|
79
|
+
assert_equal(0, XML.default_options)
|
80
|
+
|
81
|
+
XML.default_substitute_entities = true
|
82
|
+
assert(XML.default_substitute_entities)
|
83
|
+
assert_equal(XML::Parser::Options::NOENT, XML.default_options)
|
84
|
+
|
85
|
+
XML.default_substitute_entities = false
|
86
|
+
assert(!XML.default_substitute_entities)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_default_tree_indent_string
|
90
|
+
s = XML.default_tree_indent_string
|
91
|
+
assert_instance_of(String, s)
|
92
|
+
assert_equal(' ', s)
|
93
|
+
XML.default_tree_indent_string = 'uga'
|
94
|
+
s = XML.default_tree_indent_string
|
95
|
+
assert_instance_of(String, s)
|
96
|
+
assert_equal('uga', s)
|
97
|
+
XML.default_tree_indent_string = ' '
|
98
|
+
s = XML.default_tree_indent_string
|
99
|
+
assert_instance_of(String, s)
|
100
|
+
assert_equal(' ', s)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_default_validity_checking
|
104
|
+
XML.default_validity_checking = false
|
105
|
+
assert(!XML.default_validity_checking)
|
106
|
+
assert_equal(0, XML.default_options)
|
107
|
+
|
108
|
+
XML.default_validity_checking = true
|
109
|
+
assert(XML.default_validity_checking)
|
110
|
+
assert_equal(XML::Parser::Options::DTDVALID, XML.default_options)
|
111
|
+
|
112
|
+
XML.default_validity_checking = false
|
113
|
+
assert(!XML.default_validity_checking)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_default_warnings
|
117
|
+
XML.default_warnings = false
|
118
|
+
assert(!XML.default_warnings)
|
119
|
+
assert_equal(XML::Parser::Options::NOWARNING, XML.default_options)
|
120
|
+
|
121
|
+
XML.default_warnings = true
|
122
|
+
assert(XML.default_warnings)
|
123
|
+
assert_equal(0, XML.default_options)
|
124
|
+
|
125
|
+
XML.default_warnings = false
|
126
|
+
assert(!XML.default_warnings)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_enabled_automata
|
130
|
+
assert_equal(true, XML.enabled_automata?)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_enabled_c14n
|
134
|
+
assert_equal(true, XML.enabled_c14n?)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_enabled_catalog
|
138
|
+
assert_equal(true, XML.enabled_catalog?)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_enabled_debug
|
142
|
+
assert_equal(true, XML.enabled_debug?)
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_enabled_docbook
|
146
|
+
assert_equal(true, XML.enabled_docbook?)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_enabled_ftp
|
150
|
+
assert_equal(true, XML.enabled_ftp?)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_enabled_http
|
154
|
+
assert_equal(true, XML.enabled_http?)
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_enabled_html
|
158
|
+
assert_equal(true, XML.enabled_html?)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_enabled_iconv
|
162
|
+
assert_equal(true, XML.enabled_iconv?)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_enabled_memory_debug
|
166
|
+
assert_equal(false, XML.enabled_memory_debug?)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_enabled_regexp
|
170
|
+
assert_equal(true, XML.enabled_regexp?)
|
171
|
+
end
|
172
|
+
|
173
|
+
def test_enabled_schemas
|
174
|
+
assert_equal(true, XML.enabled_schemas?)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_enabled_thread
|
178
|
+
assert_equal(true, XML.enabled_thread?)
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_enabled_unicode
|
182
|
+
assert_equal(true, XML.enabled_unicode?)
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_enabled_xinclude
|
186
|
+
assert_equal(true, XML.enabled_xinclude?)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_enabled_xpath
|
190
|
+
assert_equal(true, XML.enabled_xpath?)
|
191
|
+
end
|
192
|
+
|
193
|
+
def test_enabled_xpointer
|
194
|
+
assert_equal(true, XML.enabled_xpointer?)
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_enabled_zlib
|
198
|
+
assert_equal(true, XML.enabled_zlib?)
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_intent_tree_output
|
202
|
+
assert(TrueClass, XML.indent_tree_output)
|
203
|
+
|
204
|
+
XML.indent_tree_output = false
|
205
|
+
assert(FalseClass, XML.indent_tree_output)
|
206
|
+
|
207
|
+
XML.indent_tree_output = true
|
208
|
+
assert(TrueClass, XML.indent_tree_output)
|
209
|
+
end
|
210
|
+
|
211
|
+
def test_version
|
212
|
+
assert_instance_of(String, XML::VERSION)
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_vernum
|
216
|
+
assert_instance_of(Fixnum, XML::VERNUM)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_libxml_parser_features
|
220
|
+
assert_instance_of(Array, XML.features)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_default_options
|
224
|
+
assert_equal(0, XML.default_options)
|
225
|
+
end
|
226
|
+
end
|