rgen 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +28 -0
- data/Rakefile +3 -4
- data/lib/ea_support/uml13_ea_metamodel.rb +3 -3
- data/lib/ea_support/uml13_ea_to_uml13.rb +33 -2
- data/lib/ea_support/uml13_to_uml13_ea.rb +7 -0
- data/lib/mmgen/mm_ext/ecore_mmgen_ext.rb +4 -4
- data/lib/mmgen/templates/metamodel_generator.tpl +143 -143
- data/lib/rgen/ecore/ecore.rb +11 -1
- data/lib/rgen/ecore/ecore_interface.rb +47 -0
- data/lib/rgen/ecore/ecore_to_ruby.rb +166 -0
- data/lib/rgen/ecore/{ecore_transformer.rb → ruby_to_ecore.rb} +11 -11
- data/lib/rgen/environment.rb +15 -2
- data/lib/rgen/fragment/dump_file_cache.rb +63 -0
- data/lib/rgen/fragment/fragmented_model.rb +139 -0
- data/lib/rgen/fragment/model_fragment.rb +268 -0
- data/lib/rgen/instantiator/abstract_xml_instantiator.rb +44 -72
- data/lib/rgen/instantiator/default_xml_instantiator.rb +2 -2
- data/lib/rgen/instantiator/ecore_xml_instantiator.rb +16 -1
- data/lib/rgen/instantiator/json_instantiator.rb +16 -2
- data/lib/rgen/instantiator/nodebased_xml_instantiator.rb +118 -138
- data/lib/rgen/instantiator/qualified_name_resolver.rb +5 -1
- data/lib/rgen/instantiator/reference_resolver.rb +126 -24
- data/lib/rgen/instantiator/xmi11_instantiator.rb +6 -2
- data/lib/rgen/metamodel_builder.rb +18 -6
- data/lib/rgen/metamodel_builder/builder_extensions.rb +431 -407
- data/lib/rgen/metamodel_builder/builder_runtime.rb +8 -8
- data/lib/rgen/metamodel_builder/constant_order_helper.rb +4 -4
- data/lib/rgen/metamodel_builder/data_types.rb +5 -1
- data/lib/rgen/metamodel_builder/intermediate/feature.rb +167 -0
- data/lib/rgen/metamodel_builder/module_extension.rb +2 -2
- data/lib/rgen/model_builder.rb +10 -5
- data/lib/rgen/model_builder/builder_context.rb +17 -1
- data/lib/rgen/serializer/opposite_reference_filter.rb +18 -0
- data/lib/rgen/serializer/qualified_name_provider.rb +45 -0
- data/lib/rgen/template_language/template_container.rb +3 -1
- data/lib/rgen/{auto_class_creator.rb → util/auto_class_creator.rb} +6 -1
- data/lib/rgen/util/cached_glob.rb +67 -0
- data/lib/rgen/util/file_cache_map.rb +104 -0
- data/lib/rgen/util/file_change_detector.rb +78 -0
- data/lib/rgen/{method_delegation.rb → util/method_delegation.rb} +18 -3
- data/lib/rgen/{model_comparator.rb → util/model_comparator.rb} +17 -5
- data/lib/rgen/{model_comparator_base.rb → util/model_comparator_base.rb} +6 -1
- data/lib/rgen/{model_dumper.rb → util/model_dumper.rb} +6 -1
- data/lib/rgen/{name_helper.rb → util/name_helper.rb} +6 -1
- data/lib/rgen/util/pattern_matcher.rb +329 -0
- data/lib/transformers/uml13_to_ecore.rb +103 -60
- data/test/ecore_self_test.rb +43 -42
- data/test/json_test.rb +15 -0
- data/test/metamodel_builder_test.rb +361 -206
- data/test/metamodel_from_ecore_test.rb +45 -0
- data/test/metamodel_order_test.rb +10 -4
- data/test/metamodel_roundtrip_test.rb +2 -2
- data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +1 -1
- data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +50 -50
- data/test/method_delegation_test.rb +9 -9
- data/test/model_builder/ecore_internal.rb +19 -9
- data/test/model_builder/serializer_test.rb +1 -1
- data/test/reference_resolver_test.rb +79 -12
- data/test/rgen_test.rb +2 -0
- data/test/template_language_test.rb +7 -0
- data/test/template_language_test/templates/callback_indent_test/a.tpl +12 -0
- data/test/template_language_test/templates/callback_indent_test/b.tpl +5 -0
- data/test/testmodel/ea_testmodel_regenerated.xml +588 -583
- data/test/transformer_test.rb +3 -3
- data/test/util/file_cache_map_test.rb +91 -0
- data/test/util/file_cache_map_test/testdir/fileA +1 -0
- data/test/util_test.rb +4 -0
- data/test/xml_instantiator_test.rb +139 -135
- metadata +49 -104
- data/lib/rgen/ecore/ecore_instantiator.rb +0 -31
- data/lib/rgen/metamodel_builder/metamodel_description.rb +0 -232
- data/redist/xmlscan/ChangeLog +0 -1301
- data/redist/xmlscan/README +0 -34
- data/redist/xmlscan/THANKS +0 -11
- data/redist/xmlscan/doc/changes.html +0 -74
- data/redist/xmlscan/doc/changes.rd +0 -80
- data/redist/xmlscan/doc/en/conformance.html +0 -136
- data/redist/xmlscan/doc/en/conformance.rd +0 -152
- data/redist/xmlscan/doc/en/manual.html +0 -356
- data/redist/xmlscan/doc/en/manual.rd +0 -402
- data/redist/xmlscan/doc/ja/conformance.ja.html +0 -118
- data/redist/xmlscan/doc/ja/conformance.ja.rd +0 -134
- data/redist/xmlscan/doc/ja/manual.ja.html +0 -325
- data/redist/xmlscan/doc/ja/manual.ja.rd +0 -370
- data/redist/xmlscan/doc/src/Makefile +0 -41
- data/redist/xmlscan/doc/src/conformance.rd.src +0 -256
- data/redist/xmlscan/doc/src/langsplit.rb +0 -110
- data/redist/xmlscan/doc/src/manual.rd.src +0 -614
- data/redist/xmlscan/install.rb +0 -41
- data/redist/xmlscan/lib/xmlscan/encoding.rb +0 -311
- data/redist/xmlscan/lib/xmlscan/htmlscan.rb +0 -289
- data/redist/xmlscan/lib/xmlscan/namespace.rb +0 -352
- data/redist/xmlscan/lib/xmlscan/parser.rb +0 -299
- data/redist/xmlscan/lib/xmlscan/scanner.rb +0 -1109
- data/redist/xmlscan/lib/xmlscan/version.rb +0 -22
- data/redist/xmlscan/lib/xmlscan/visitor.rb +0 -158
- data/redist/xmlscan/lib/xmlscan/xmlchar.rb +0 -441
- data/redist/xmlscan/memo/CONFORMANCE +0 -1249
- data/redist/xmlscan/memo/PRODUCTIONS +0 -195
- data/redist/xmlscan/memo/contentspec.ry +0 -335
- data/redist/xmlscan/samples/chibixml.rb +0 -105
- data/redist/xmlscan/samples/getxmlchar.rb +0 -122
- data/redist/xmlscan/samples/rexml.rb +0 -159
- data/redist/xmlscan/samples/xmlbench.rb +0 -88
- data/redist/xmlscan/samples/xmlbench/parser/chibixml.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/nqxml.rb +0 -29
- data/redist/xmlscan/samples/xmlbench/parser/rexml.rb +0 -62
- data/redist/xmlscan/samples/xmlbench/parser/xmlparser.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb +0 -62
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan.rb +0 -99
- data/redist/xmlscan/samples/xmlbench/xmlbench-lib.rb +0 -116
- data/redist/xmlscan/samples/xmlconftest.rb +0 -200
- data/redist/xmlscan/test.rb +0 -7
- data/redist/xmlscan/tests/deftestcase.rb +0 -73
- data/redist/xmlscan/tests/runtest.rb +0 -47
- data/redist/xmlscan/tests/testall.rb +0 -14
- data/redist/xmlscan/tests/testencoding.rb +0 -438
- data/redist/xmlscan/tests/testhtmlscan.rb +0 -752
- data/redist/xmlscan/tests/testnamespace.rb +0 -457
- data/redist/xmlscan/tests/testparser.rb +0 -591
- data/redist/xmlscan/tests/testscanner.rb +0 -1749
- data/redist/xmlscan/tests/testxmlchar.rb +0 -143
- data/redist/xmlscan/tests/visitor.rb +0 -34
@@ -1,591 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# tests/testparser.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: testparser.rb,v 1.16 2003/02/28 12:31:07 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'test/unit'
|
10
|
-
require 'deftestcase'
|
11
|
-
require 'xmlscan/parser'
|
12
|
-
require 'visitor'
|
13
|
-
|
14
|
-
|
15
|
-
class TestXMLParser < Test::Unit::TestCase
|
16
|
-
|
17
|
-
include DefTestCase
|
18
|
-
|
19
|
-
Visitor = RecordingVisitor.new_class(XMLScan::Visitor)
|
20
|
-
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def setup
|
25
|
-
@v = Visitor.new
|
26
|
-
@s = XMLScan::XMLParser.new(@v)
|
27
|
-
end
|
28
|
-
|
29
|
-
def parse(src)
|
30
|
-
@s.parse src
|
31
|
-
@v.result
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
public
|
36
|
-
|
37
|
-
deftestcase 'xmldecl', <<-'TESTCASEEND'
|
38
|
-
|
39
|
-
'<?xml version="1.0" ?><hoge/>'
|
40
|
-
[ :on_xmldecl ]
|
41
|
-
[ :on_xmldecl_version, '1.0' ]
|
42
|
-
[ :on_xmldecl_end ]
|
43
|
-
[ :on_stag, 'hoge' ]
|
44
|
-
[ :on_stag_end_empty, 'hoge' ]
|
45
|
-
|
46
|
-
'<?xml version="1.01" ?><hoge/>'
|
47
|
-
[ :on_xmldecl ]
|
48
|
-
[ :warning, "unsupported XML version `1.01'" ]
|
49
|
-
[ :on_xmldecl_version, '1.01' ]
|
50
|
-
[ :on_xmldecl_end ]
|
51
|
-
[ :on_stag, 'hoge' ]
|
52
|
-
[ :on_stag_end_empty, 'hoge' ]
|
53
|
-
|
54
|
-
'<?xml version="1.0" standalone="yes" ?><hoge/>'
|
55
|
-
[ :on_xmldecl ]
|
56
|
-
[ :on_xmldecl_version, '1.0' ]
|
57
|
-
[ :on_xmldecl_standalone, 'yes' ]
|
58
|
-
[ :on_xmldecl_end ]
|
59
|
-
[ :on_stag, 'hoge' ]
|
60
|
-
[ :on_stag_end_empty, 'hoge' ]
|
61
|
-
|
62
|
-
'<?xml version="1.0" standalone="no" ?><hoge/>'
|
63
|
-
[ :on_xmldecl ]
|
64
|
-
[ :on_xmldecl_version, '1.0' ]
|
65
|
-
[ :on_xmldecl_standalone, 'no' ]
|
66
|
-
[ :on_xmldecl_end ]
|
67
|
-
[ :on_stag, 'hoge' ]
|
68
|
-
[ :on_stag_end_empty, 'hoge' ]
|
69
|
-
|
70
|
-
'<?xml version="1.0" standalone="hoge" ?><hoge/>'
|
71
|
-
[ :on_xmldecl ]
|
72
|
-
[ :on_xmldecl_version, '1.0' ]
|
73
|
-
[ :parse_error, "standalone declaration must be either `yes' or `no'" ]
|
74
|
-
[ :on_xmldecl_standalone, 'hoge' ]
|
75
|
-
[ :on_xmldecl_end ]
|
76
|
-
[ :on_stag, 'hoge' ]
|
77
|
-
[ :on_stag_end_empty, 'hoge' ]
|
78
|
-
|
79
|
-
'<?xml version="1.0" standalone="YES" ?><hoge/>'
|
80
|
-
[ :on_xmldecl ]
|
81
|
-
[ :on_xmldecl_version, '1.0' ]
|
82
|
-
[ :parse_error, "standalone declaration must be either `yes' or `no'" ]
|
83
|
-
[ :on_xmldecl_standalone, 'YES' ]
|
84
|
-
[ :on_xmldecl_end ]
|
85
|
-
[ :on_stag, 'hoge' ]
|
86
|
-
[ :on_stag_end_empty, 'hoge' ]
|
87
|
-
|
88
|
-
TESTCASEEND
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
deftestcase 'doctype', <<-'TESTCASEEND'
|
93
|
-
|
94
|
-
'<!DOCTYPE hoge PUBLIC "foo" "bar"><hoge/>'
|
95
|
-
[ :on_doctype, 'hoge', 'foo', 'bar' ]
|
96
|
-
[ :on_stag, 'hoge' ]
|
97
|
-
[ :on_stag_end_empty, 'hoge' ]
|
98
|
-
|
99
|
-
'<!DOCTYPE hoge PUBLIC "foo"><hoge/>'
|
100
|
-
[ :parse_error, "public external ID must have both public ID and system ID" ]
|
101
|
-
[ :on_doctype, 'hoge', 'foo', nil ]
|
102
|
-
[ :on_stag, 'hoge' ]
|
103
|
-
[ :on_stag_end_empty, 'hoge' ]
|
104
|
-
|
105
|
-
'<!DOCTYPE hoge SYSTEM "foo"><hoge/>'
|
106
|
-
[ :on_doctype, 'hoge', nil, 'foo' ]
|
107
|
-
[ :on_stag, 'hoge' ]
|
108
|
-
[ :on_stag_end_empty, 'hoge' ]
|
109
|
-
|
110
|
-
TESTCASEEND
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
deftestcase 'ignore_space', <<-'TESTCASEEND'
|
115
|
-
|
116
|
-
'<?xml version="1.0"?> <!DOCTYPE hoge> <hoge/>'
|
117
|
-
[ :on_xmldecl ]
|
118
|
-
[ :on_xmldecl_version, '1.0' ]
|
119
|
-
[ :on_xmldecl_end ]
|
120
|
-
[ :on_doctype, 'hoge', nil, nil ]
|
121
|
-
[ :on_stag, 'hoge' ]
|
122
|
-
[ :on_stag_end_empty, 'hoge' ]
|
123
|
-
|
124
|
-
'<?xml version="1.0"?> <!DOCTYPE hoge> <hoge/> '
|
125
|
-
[ :on_xmldecl ]
|
126
|
-
[ :on_xmldecl_version, '1.0' ]
|
127
|
-
[ :on_xmldecl_end ]
|
128
|
-
[ :on_doctype, 'hoge', nil, nil ]
|
129
|
-
[ :on_stag, 'hoge' ]
|
130
|
-
[ :on_stag_end_empty, 'hoge' ]
|
131
|
-
|
132
|
-
' <!DOCTYPE hoge> <hoge> </hoge> '
|
133
|
-
[ :on_doctype, 'hoge', nil, nil ]
|
134
|
-
[ :on_stag, 'hoge' ]
|
135
|
-
[ :on_stag_end, 'hoge' ]
|
136
|
-
[ :on_chardata, ' ' ]
|
137
|
-
[ :on_etag, 'hoge' ]
|
138
|
-
|
139
|
-
TESTCASEEND
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
deftestcase 'pi', <<-'TESTCASEEND'
|
144
|
-
|
145
|
-
' <?xml ?><hoge/>'
|
146
|
-
[ :parse_error, "reserved PI target `xml'" ]
|
147
|
-
[ :on_pi, 'xml', '' ]
|
148
|
-
[ :on_stag, 'hoge' ]
|
149
|
-
[ :on_stag_end_empty, 'hoge' ]
|
150
|
-
|
151
|
-
' <?Xml ?><hoge/>'
|
152
|
-
[ :parse_error, "reserved PI target `Xml'" ]
|
153
|
-
[ :on_pi, 'Xml', '' ]
|
154
|
-
[ :on_stag, 'hoge' ]
|
155
|
-
[ :on_stag_end_empty, 'hoge' ]
|
156
|
-
|
157
|
-
' <?XML ?><hoge/>'
|
158
|
-
[ :parse_error, "reserved PI target `XML'" ]
|
159
|
-
[ :on_pi, 'XML', '' ]
|
160
|
-
[ :on_stag, 'hoge' ]
|
161
|
-
[ :on_stag_end_empty, 'hoge' ]
|
162
|
-
|
163
|
-
TESTCASEEND
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
deftestcase 'element_nesting', <<-'TESTCASEEND'
|
169
|
-
|
170
|
-
'<hoge></hoge>'
|
171
|
-
[ :on_stag, 'hoge' ]
|
172
|
-
[ :on_stag_end, 'hoge' ]
|
173
|
-
[ :on_etag, 'hoge' ]
|
174
|
-
|
175
|
-
'<hoge><fuga></fuga></hoge>'
|
176
|
-
[ :on_stag, 'hoge' ]
|
177
|
-
[ :on_stag_end, 'hoge' ]
|
178
|
-
[ :on_stag, 'fuga' ]
|
179
|
-
[ :on_stag_end, 'fuga' ]
|
180
|
-
[ :on_etag, 'fuga' ]
|
181
|
-
[ :on_etag, 'hoge' ]
|
182
|
-
|
183
|
-
'<hoge><fuga/></hoge>'
|
184
|
-
[ :on_stag, 'hoge' ]
|
185
|
-
[ :on_stag_end, 'hoge' ]
|
186
|
-
[ :on_stag, 'fuga' ]
|
187
|
-
[ :on_stag_end_empty, 'fuga' ]
|
188
|
-
[ :on_etag, 'hoge' ]
|
189
|
-
|
190
|
-
'<hoge/>'
|
191
|
-
[ :on_stag, 'hoge' ]
|
192
|
-
[ :on_stag_end_empty, 'hoge' ]
|
193
|
-
|
194
|
-
'<hoge><fuga>'
|
195
|
-
[ :on_stag, 'hoge' ]
|
196
|
-
[ :on_stag_end, 'hoge' ]
|
197
|
-
[ :on_stag, 'fuga' ]
|
198
|
-
[ :on_stag_end, 'fuga' ]
|
199
|
-
[ :parse_error, "unclosed element `fuga' meets EOF" ]
|
200
|
-
[ :on_etag, 'fuga' ]
|
201
|
-
[ :parse_error, "unclosed element `hoge' meets EOF" ]
|
202
|
-
[ :on_etag, 'hoge' ]
|
203
|
-
|
204
|
-
'<hoge><fuga></fuga>'
|
205
|
-
[ :on_stag, 'hoge' ]
|
206
|
-
[ :on_stag_end, 'hoge' ]
|
207
|
-
[ :on_stag, 'fuga' ]
|
208
|
-
[ :on_stag_end, 'fuga' ]
|
209
|
-
[ :on_etag, 'fuga' ]
|
210
|
-
[ :parse_error, "unclosed element `hoge' meets EOF" ]
|
211
|
-
[ :on_etag, 'hoge' ]
|
212
|
-
|
213
|
-
'<hoge><fuga></hoge></fuga>'
|
214
|
-
[ :on_stag, 'hoge' ]
|
215
|
-
[ :on_stag_end, 'hoge' ]
|
216
|
-
[ :on_stag, 'fuga' ]
|
217
|
-
[ :on_stag_end, 'fuga' ]
|
218
|
-
[ :wellformed_error, "element type `hoge' is not matched" ]
|
219
|
-
[ :on_etag, 'fuga' ]
|
220
|
-
[ :wellformed_error, "element type `fuga' is not matched" ]
|
221
|
-
[ :on_etag, 'hoge' ]
|
222
|
-
|
223
|
-
'<hoge></fuga>'
|
224
|
-
[ :on_stag, 'hoge' ]
|
225
|
-
[ :on_stag_end, 'hoge' ]
|
226
|
-
[ :wellformed_error, "element type `fuga' is not matched" ]
|
227
|
-
[ :on_etag, 'hoge' ]
|
228
|
-
|
229
|
-
'</hoge>'
|
230
|
-
[ :parse_error, "end tag `hoge' appears alone" ]
|
231
|
-
[ :parse_error, "no root element was found" ]
|
232
|
-
|
233
|
-
'<hoge></hoge><fuga>'
|
234
|
-
[ :on_stag, 'hoge' ]
|
235
|
-
[ :on_stag_end, 'hoge' ]
|
236
|
-
[ :on_etag, 'hoge' ]
|
237
|
-
[ :parse_error, "another root element is found" ]
|
238
|
-
[ :on_stag, 'fuga' ]
|
239
|
-
[ :on_stag_end, 'fuga' ]
|
240
|
-
[ :parse_error, "unclosed element `fuga' meets EOF" ]
|
241
|
-
[ :on_etag, 'fuga' ]
|
242
|
-
|
243
|
-
'<hoge></hoge></fuga>'
|
244
|
-
[ :on_stag, 'hoge' ]
|
245
|
-
[ :on_stag_end, 'hoge' ]
|
246
|
-
[ :on_etag, 'hoge' ]
|
247
|
-
[ :parse_error, "end tag `fuga' appears alone" ]
|
248
|
-
|
249
|
-
'<hoge/><fuga/>'
|
250
|
-
[ :on_stag, 'hoge' ]
|
251
|
-
[ :on_stag_end_empty, 'hoge' ]
|
252
|
-
[ :parse_error, "another root element is found" ]
|
253
|
-
[ :on_stag, 'fuga' ]
|
254
|
-
[ :on_stag_end_empty, 'fuga' ]
|
255
|
-
|
256
|
-
TESTCASEEND
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
deftestcase 'outside', <<-'TESTCASEEND'
|
261
|
-
|
262
|
-
'<hoge>fuga</hoge>'
|
263
|
-
[ :on_stag, 'hoge' ]
|
264
|
-
[ :on_stag_end, 'hoge' ]
|
265
|
-
[ :on_chardata, 'fuga' ]
|
266
|
-
[ :on_etag, 'hoge' ]
|
267
|
-
|
268
|
-
' <hoge>fuga</hoge> '
|
269
|
-
[ :on_stag, 'hoge' ]
|
270
|
-
[ :on_stag_end, 'hoge' ]
|
271
|
-
[ :on_chardata, 'fuga' ]
|
272
|
-
[ :on_etag, 'hoge' ]
|
273
|
-
|
274
|
-
'<hoge><![CDATA[fuga]]></hoge>'
|
275
|
-
[ :on_stag, 'hoge' ]
|
276
|
-
[ :on_stag_end, 'hoge' ]
|
277
|
-
[ :on_cdata, 'fuga' ]
|
278
|
-
[ :on_etag, 'hoge' ]
|
279
|
-
|
280
|
-
'fuga<hoge></hoge>'
|
281
|
-
[ :parse_error, "content of element is found outside of root element" ]
|
282
|
-
[ :on_chardata, 'fuga' ]
|
283
|
-
[ :on_stag, 'hoge' ]
|
284
|
-
[ :on_stag_end, 'hoge' ]
|
285
|
-
[ :on_etag, 'hoge' ]
|
286
|
-
|
287
|
-
'<![CDATA[fuga]]><hoge></hoge>'
|
288
|
-
[ :parse_error, "CDATA section is found outside of root element" ]
|
289
|
-
[ :on_cdata, 'fuga' ]
|
290
|
-
[ :on_stag, 'hoge' ]
|
291
|
-
[ :on_stag_end, 'hoge' ]
|
292
|
-
[ :on_etag, 'hoge' ]
|
293
|
-
|
294
|
-
'<hoge></hoge>fuga'
|
295
|
-
[ :on_stag, 'hoge' ]
|
296
|
-
[ :on_stag_end, 'hoge' ]
|
297
|
-
[ :on_etag, 'hoge' ]
|
298
|
-
[ :parse_error, "content of element is found outside of root element" ]
|
299
|
-
[ :on_chardata, 'fuga' ]
|
300
|
-
|
301
|
-
'<hoge></hoge><![CDATA[fuga]]>'
|
302
|
-
[ :on_stag, 'hoge' ]
|
303
|
-
[ :on_stag_end, 'hoge' ]
|
304
|
-
[ :on_etag, 'hoge' ]
|
305
|
-
[ :parse_error, "CDATA section is found outside of root element" ]
|
306
|
-
[ :on_cdata, 'fuga' ]
|
307
|
-
|
308
|
-
'<hoge></hoge><fuga>foo</fuga>'
|
309
|
-
[ :on_stag, 'hoge' ]
|
310
|
-
[ :on_stag_end, 'hoge' ]
|
311
|
-
[ :on_etag, 'hoge' ]
|
312
|
-
[ :parse_error, "another root element is found" ]
|
313
|
-
[ :on_stag, 'fuga' ]
|
314
|
-
[ :on_stag_end, 'fuga' ]
|
315
|
-
[ :on_chardata, 'foo' ]
|
316
|
-
[ :on_etag, 'fuga' ]
|
317
|
-
|
318
|
-
'<hoge></hoge><fuga><![CDATA[fuga]]></fuga>'
|
319
|
-
[ :on_stag, 'hoge' ]
|
320
|
-
[ :on_stag_end, 'hoge' ]
|
321
|
-
[ :on_etag, 'hoge' ]
|
322
|
-
[ :parse_error, "another root element is found" ]
|
323
|
-
[ :on_stag, 'fuga' ]
|
324
|
-
[ :on_stag_end, 'fuga' ]
|
325
|
-
[ :on_cdata, 'fuga' ]
|
326
|
-
[ :on_etag, 'fuga' ]
|
327
|
-
|
328
|
-
TESTCASEEND
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
deftestcase 'entityref', <<-'TESTCASEEND'
|
333
|
-
|
334
|
-
'<hoge>foo<bar</hoge>'
|
335
|
-
[ :on_stag, 'hoge' ]
|
336
|
-
[ :on_stag_end, 'hoge' ]
|
337
|
-
[ :on_chardata, 'foo' ]
|
338
|
-
[ :on_entityref, 'lt' ]
|
339
|
-
[ :on_chardata, 'bar' ]
|
340
|
-
[ :on_etag, 'hoge' ]
|
341
|
-
|
342
|
-
'<hoge>foo>bar</hoge>'
|
343
|
-
[ :on_stag, 'hoge' ]
|
344
|
-
[ :on_stag_end, 'hoge' ]
|
345
|
-
[ :on_chardata, 'foo' ]
|
346
|
-
[ :on_entityref, 'gt' ]
|
347
|
-
[ :on_chardata, 'bar' ]
|
348
|
-
[ :on_etag, 'hoge' ]
|
349
|
-
|
350
|
-
'<hoge>foo&bar</hoge>'
|
351
|
-
[ :on_stag, 'hoge' ]
|
352
|
-
[ :on_stag_end, 'hoge' ]
|
353
|
-
[ :on_chardata, 'foo' ]
|
354
|
-
[ :on_entityref, 'amp' ]
|
355
|
-
[ :on_chardata, 'bar' ]
|
356
|
-
[ :on_etag, 'hoge' ]
|
357
|
-
|
358
|
-
'<hoge>foo"bar</hoge>'
|
359
|
-
[ :on_stag, 'hoge' ]
|
360
|
-
[ :on_stag_end, 'hoge' ]
|
361
|
-
[ :on_chardata, 'foo' ]
|
362
|
-
[ :on_entityref, 'quot' ]
|
363
|
-
[ :on_chardata, 'bar' ]
|
364
|
-
[ :on_etag, 'hoge' ]
|
365
|
-
|
366
|
-
'<hoge>foo'bar</hoge>'
|
367
|
-
[ :on_stag, 'hoge' ]
|
368
|
-
[ :on_stag_end, 'hoge' ]
|
369
|
-
[ :on_chardata, 'foo' ]
|
370
|
-
[ :on_entityref, 'apos' ]
|
371
|
-
[ :on_chardata, 'bar' ]
|
372
|
-
[ :on_etag, 'hoge' ]
|
373
|
-
|
374
|
-
'<hoge>foo&fuga;bar</hoge>'
|
375
|
-
[ :on_stag, 'hoge' ]
|
376
|
-
[ :on_stag_end, 'hoge' ]
|
377
|
-
[ :on_chardata, 'foo' ]
|
378
|
-
[ :on_entityref, 'fuga' ]
|
379
|
-
[ :on_chardata, 'bar' ]
|
380
|
-
[ :on_etag, 'hoge' ]
|
381
|
-
|
382
|
-
TESTCASEEND
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
deftestcase 'charref', <<-'TESTCASEEND'
|
387
|
-
|
388
|
-
'<hoge>fuga</hoge>'
|
389
|
-
[ :on_stag, 'hoge' ]
|
390
|
-
[ :on_stag_end, 'hoge' ]
|
391
|
-
[ :on_chardata, 'fu' ]
|
392
|
-
[ :on_charref, 103 ]
|
393
|
-
[ :on_chardata, 'a' ]
|
394
|
-
[ :on_etag, 'hoge' ]
|
395
|
-
|
396
|
-
'<hoge>fuga</hoge>'
|
397
|
-
[ :on_stag, 'hoge' ]
|
398
|
-
[ :on_stag_end, 'hoge' ]
|
399
|
-
[ :on_chardata, 'fu' ]
|
400
|
-
[ :on_charref_hex, 103 ]
|
401
|
-
[ :on_chardata, 'a' ]
|
402
|
-
[ :on_etag, 'hoge' ]
|
403
|
-
|
404
|
-
TESTCASEEND
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
deftestcase 'attr_entityref', <<-'TESTCASEEND'
|
409
|
-
|
410
|
-
'<hoge fuga="foo<bar"></hoge>'
|
411
|
-
[ :on_stag, 'hoge' ]
|
412
|
-
[ :on_attribute, 'fuga' ]
|
413
|
-
[ :on_attr_value, 'foo' ]
|
414
|
-
[ :on_attr_entityref, 'lt' ]
|
415
|
-
[ :on_attr_value, 'bar' ]
|
416
|
-
[ :on_attribute_end, 'fuga' ]
|
417
|
-
[ :on_stag_end, 'hoge' ]
|
418
|
-
[ :on_etag, 'hoge' ]
|
419
|
-
|
420
|
-
'<hoge fuga="foo>bar"></hoge>'
|
421
|
-
[ :on_stag, 'hoge' ]
|
422
|
-
[ :on_attribute, 'fuga' ]
|
423
|
-
[ :on_attr_value, 'foo' ]
|
424
|
-
[ :on_attr_entityref, 'gt' ]
|
425
|
-
[ :on_attr_value, 'bar' ]
|
426
|
-
[ :on_attribute_end, 'fuga' ]
|
427
|
-
[ :on_stag_end, 'hoge' ]
|
428
|
-
[ :on_etag, 'hoge' ]
|
429
|
-
|
430
|
-
'<hoge fuga="foo&bar"></hoge>'
|
431
|
-
[ :on_stag, 'hoge' ]
|
432
|
-
[ :on_attribute, 'fuga' ]
|
433
|
-
[ :on_attr_value, 'foo' ]
|
434
|
-
[ :on_attr_entityref, 'amp' ]
|
435
|
-
[ :on_attr_value, 'bar' ]
|
436
|
-
[ :on_attribute_end, 'fuga' ]
|
437
|
-
[ :on_stag_end, 'hoge' ]
|
438
|
-
[ :on_etag, 'hoge' ]
|
439
|
-
|
440
|
-
'<hoge fuga="foo"bar"></hoge>'
|
441
|
-
[ :on_stag, 'hoge' ]
|
442
|
-
[ :on_attribute, 'fuga' ]
|
443
|
-
[ :on_attr_value, 'foo' ]
|
444
|
-
[ :on_attr_entityref, 'quot' ]
|
445
|
-
[ :on_attr_value, 'bar' ]
|
446
|
-
[ :on_attribute_end, 'fuga' ]
|
447
|
-
[ :on_stag_end, 'hoge' ]
|
448
|
-
[ :on_etag, 'hoge' ]
|
449
|
-
|
450
|
-
'<hoge fuga="foo'bar"></hoge>'
|
451
|
-
[ :on_stag, 'hoge' ]
|
452
|
-
[ :on_attribute, 'fuga' ]
|
453
|
-
[ :on_attr_value, 'foo' ]
|
454
|
-
[ :on_attr_entityref, 'apos' ]
|
455
|
-
[ :on_attr_value, 'bar' ]
|
456
|
-
[ :on_attribute_end, 'fuga' ]
|
457
|
-
[ :on_stag_end, 'hoge' ]
|
458
|
-
[ :on_etag, 'hoge' ]
|
459
|
-
|
460
|
-
'<hoge fuga="foo&HOGE;bar"></hoge>'
|
461
|
-
[ :on_stag, 'hoge' ]
|
462
|
-
[ :on_attribute, 'fuga' ]
|
463
|
-
[ :on_attr_value, 'foo' ]
|
464
|
-
[ :on_attr_entityref, 'HOGE' ]
|
465
|
-
[ :on_attr_value, 'bar' ]
|
466
|
-
[ :on_attribute_end, 'fuga' ]
|
467
|
-
[ :on_stag_end, 'hoge' ]
|
468
|
-
[ :on_etag, 'hoge' ]
|
469
|
-
|
470
|
-
TESTCASEEND
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
deftestcase 'attr_charref', <<-'TESTCASEEND'
|
475
|
-
|
476
|
-
'<hoge foo="fuga"/>'
|
477
|
-
[ :on_stag, 'hoge' ]
|
478
|
-
[ :on_attribute, 'foo' ]
|
479
|
-
[ :on_attr_value, 'fu' ]
|
480
|
-
[ :on_attr_charref, 103 ]
|
481
|
-
[ :on_attr_value, 'a' ]
|
482
|
-
[ :on_attribute_end, 'foo' ]
|
483
|
-
[ :on_stag_end_empty, 'hoge' ]
|
484
|
-
|
485
|
-
'<hoge foo="fuga"/>'
|
486
|
-
[ :on_stag, 'hoge' ]
|
487
|
-
[ :on_attribute, 'foo' ]
|
488
|
-
[ :on_attr_value, 'fu' ]
|
489
|
-
[ :on_attr_charref_hex, 103 ]
|
490
|
-
[ :on_attr_value, 'a' ]
|
491
|
-
[ :on_attribute_end, 'foo' ]
|
492
|
-
[ :on_stag_end_empty, 'hoge' ]
|
493
|
-
|
494
|
-
TESTCASEEND
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
deftestcase 'normalize', <<-'TESTCASEEND'
|
499
|
-
|
500
|
-
"<hoge fuga=' foo bar '></hoge>"
|
501
|
-
[ :on_stag, 'hoge' ]
|
502
|
-
[ :on_attribute, 'fuga' ]
|
503
|
-
[ :on_attr_value, ' foo bar ' ]
|
504
|
-
[ :on_attribute_end, 'fuga' ]
|
505
|
-
[ :on_stag_end, 'hoge' ]
|
506
|
-
[ :on_etag, 'hoge' ]
|
507
|
-
|
508
|
-
"<hoge fuga='\tfoo\nbar\t'></hoge>"
|
509
|
-
[ :on_stag, 'hoge' ]
|
510
|
-
[ :on_attribute, 'fuga' ]
|
511
|
-
[ :on_attr_value, ' foo bar ' ]
|
512
|
-
[ :on_attribute_end, 'fuga' ]
|
513
|
-
[ :on_stag_end, 'hoge' ]
|
514
|
-
[ :on_etag, 'hoge' ]
|
515
|
-
|
516
|
-
"<hoge fuga='\tfoo\r\nbar\t'></hoge>"
|
517
|
-
[ :on_stag, 'hoge' ]
|
518
|
-
[ :on_attribute, 'fuga' ]
|
519
|
-
[ :on_attr_value, ' foo bar ' ]
|
520
|
-
[ :on_attribute_end, 'fuga' ]
|
521
|
-
[ :on_stag_end, 'hoge' ]
|
522
|
-
[ :on_etag, 'hoge' ]
|
523
|
-
|
524
|
-
"<hoge fuga='\tfoo\r\nbar\t'></hoge>"
|
525
|
-
[ :on_stag, 'hoge' ]
|
526
|
-
[ :on_attribute, 'fuga' ]
|
527
|
-
[ :on_attr_value, ' foo bar ' ]
|
528
|
-
[ :on_attribute_end, 'fuga' ]
|
529
|
-
[ :on_stag_end, 'hoge' ]
|
530
|
-
[ :on_etag, 'hoge' ]
|
531
|
-
|
532
|
-
"<hoge fuga='\tfoo	bar\t'></hoge>"
|
533
|
-
[ :on_stag, 'hoge' ]
|
534
|
-
[ :on_attribute, 'fuga' ]
|
535
|
-
[ :on_attr_value, ' foo' ]
|
536
|
-
[ :on_attr_charref, 9 ]
|
537
|
-
[ :on_attr_value, 'bar ' ]
|
538
|
-
[ :on_attribute_end, 'fuga' ]
|
539
|
-
[ :on_stag_end, 'hoge' ]
|
540
|
-
[ :on_etag, 'hoge' ]
|
541
|
-
|
542
|
-
TESTCASEEND
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
deftestcase 'attribute', <<-'TESTCASEEND'
|
547
|
-
|
548
|
-
'<hoge foo="bar" bar="fuga"/>'
|
549
|
-
[ :on_stag, 'hoge' ]
|
550
|
-
[ :on_attribute, 'foo' ]
|
551
|
-
[ :on_attr_value, 'bar' ]
|
552
|
-
[ :on_attribute_end, 'foo' ]
|
553
|
-
[ :on_attribute, 'bar' ]
|
554
|
-
[ :on_attr_value, 'fuga' ]
|
555
|
-
[ :on_attribute_end, 'bar' ]
|
556
|
-
[ :on_stag_end_empty, 'hoge' ]
|
557
|
-
|
558
|
-
'<hoge foo="bar" foo="fuga"/>'
|
559
|
-
[ :on_stag, 'hoge' ]
|
560
|
-
[ :on_attribute, 'foo' ]
|
561
|
-
[ :on_attr_value, 'bar' ]
|
562
|
-
[ :on_attribute_end, 'foo' ]
|
563
|
-
[ :wellformed_error, "doubled attribute `foo'" ]
|
564
|
-
[ :on_attribute, 'foo' ]
|
565
|
-
[ :on_attr_value, 'fuga' ]
|
566
|
-
[ :on_attribute_end, 'foo' ]
|
567
|
-
[ :on_stag_end_empty, 'hoge' ]
|
568
|
-
|
569
|
-
'<hoge foo="bar" foo="fuga" foo="hoge"/>'
|
570
|
-
[ :on_stag, 'hoge' ]
|
571
|
-
[ :on_attribute, 'foo' ]
|
572
|
-
[ :on_attr_value, 'bar' ]
|
573
|
-
[ :on_attribute_end, 'foo' ]
|
574
|
-
[ :wellformed_error, "doubled attribute `foo'" ]
|
575
|
-
[ :on_attribute, 'foo' ]
|
576
|
-
[ :on_attr_value, 'fuga' ]
|
577
|
-
[ :on_attribute_end, 'foo' ]
|
578
|
-
[ :wellformed_error, "doubled attribute `foo'" ]
|
579
|
-
[ :on_attribute, 'foo' ]
|
580
|
-
[ :on_attr_value, 'hoge' ]
|
581
|
-
[ :on_attribute_end, 'foo' ]
|
582
|
-
[ :on_stag_end_empty, 'hoge' ]
|
583
|
-
|
584
|
-
TESTCASEEND
|
585
|
-
|
586
|
-
end
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
load "#{File.dirname($0)}/runtest.rb" if __FILE__ == $0
|