rtext 0.8.0 → 0.9.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG +108 -84
- data/RText_Protocol +47 -4
- data/Rakefile +39 -46
- data/lib/rtext/context_builder.rb +49 -8
- data/lib/rtext/default_completer.rb +212 -163
- data/lib/rtext/default_service_provider.rb +3 -3
- data/lib/rtext/frontend/connector.rb +120 -53
- data/lib/rtext/frontend/context.rb +12 -12
- data/lib/rtext/instantiator.rb +11 -3
- data/lib/rtext/language.rb +5 -5
- data/lib/rtext/serializer.rb +1 -1
- data/lib/rtext/service.rb +264 -253
- data/lib/rtext/tokenizer.rb +1 -1
- data/test/completer_test.rb +606 -606
- data/test/context_builder_test.rb +952 -948
- data/test/frontend/context_test.rb +301 -205
- data/test/instantiator_test.rb +1773 -1691
- data/test/integration/model/test_metamodel3.ect4 +7 -0
- data/test/integration/test.rb +974 -918
- data/test/link_detector_test.rb +287 -287
- data/test/message_helper_test.rb +116 -118
- data/test/serializer_test.rb +1023 -1004
- data/test/tokenizer_test.rb +173 -173
- metadata +18 -19
- data/test/integration/backend.out +0 -13
- data/test/integration/frontend.log +0 -36049
@@ -1,948 +1,952 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
|
3
|
-
require '
|
4
|
-
require 'rgen/metamodel_builder'
|
5
|
-
require 'rtext/language'
|
6
|
-
require 'rtext/context_builder'
|
7
|
-
|
8
|
-
class ContextBuilderTest < Test
|
9
|
-
|
10
|
-
module TestMM
|
11
|
-
extend RGen::MetamodelBuilder::ModuleExtension
|
12
|
-
class TestNode < RGen::MetamodelBuilder::MMBase
|
13
|
-
has_attr 'text', String
|
14
|
-
has_attr 'unlabled', String
|
15
|
-
has_many_attr 'unlabled_array', String
|
16
|
-
has_many_attr 'nums', Integer
|
17
|
-
has_many_attr 'strings', String
|
18
|
-
has_attr 'boolean', Boolean
|
19
|
-
has_one 'related', TestNode
|
20
|
-
has_many 'others', TestNode
|
21
|
-
contains_many 'childs', TestNode, 'parent'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_root
|
26
|
-
c = build_context TestMM, <<-END
|
27
|
-
|
|
28
|
-
END
|
29
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
30
|
-
assert_nil(c.element)
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_root2
|
34
|
-
c = build_context TestMM, <<-END
|
35
|
-
|TestNode
|
36
|
-
END
|
37
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
38
|
-
assert_nil(c.element)
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_root_in_cmd
|
42
|
-
c = build_context TestMM, <<-END
|
43
|
-
Test|Node
|
44
|
-
END
|
45
|
-
assert_context c, :prefix => "Test", :feature => nil, :in_array => false, :in_block => false
|
46
|
-
assert_nil(c.element)
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_root_after_cmd
|
50
|
-
c = build_context TestMM, <<-END
|
51
|
-
TestNode|
|
52
|
-
END
|
53
|
-
assert_context c, :prefix => "TestNode", :feature => nil, :in_array => false, :in_block => false
|
54
|
-
assert_nil(c.element)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_root_after_cmd2
|
58
|
-
c = build_context TestMM, <<-END
|
59
|
-
TestNode |
|
60
|
-
END
|
61
|
-
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
62
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_root_in_lable
|
66
|
-
c = build_context TestMM, <<-END
|
67
|
-
TestNode ot|hers:
|
68
|
-
END
|
69
|
-
assert_context c, :prefix => "ot", :feature => "unlabled", :in_array => false, :in_block => false
|
70
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_root_after_lable
|
74
|
-
c = build_context TestMM, <<-END
|
75
|
-
TestNode others:|
|
76
|
-
END
|
77
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
78
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_root_after_lable2
|
82
|
-
c = build_context TestMM, <<-END
|
83
|
-
TestNode others: |
|
84
|
-
END
|
85
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
86
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_root_after_lable_with_value
|
90
|
-
c = build_context TestMM, <<-END
|
91
|
-
TestNode text: xx, others: |
|
92
|
-
END
|
93
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
94
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
95
|
-
assert_equal("xx", c.element.text)
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_root_after_lable_with_value_missing_comma
|
99
|
-
c = build_context TestMM, <<-END
|
100
|
-
TestNode text: xx others: |
|
101
|
-
END
|
102
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
103
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
104
|
-
assert_equal("xx", c.element.text)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_root_after_unlabled
|
108
|
-
c = build_context TestMM, <<-END
|
109
|
-
TestNode "bla"|
|
110
|
-
END
|
111
|
-
assert_context c, :prefix => "\"bla\"", :feature => "unlabled", :in_array => false, :in_block => false
|
112
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
113
|
-
assert_nil(c.element.unlabled)
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_root_after_unlabled_string_with_comma
|
117
|
-
c = build_context TestMM, <<-END
|
118
|
-
TestNode "a,b"|
|
119
|
-
END
|
120
|
-
assert_context c, :prefix => "\"a,b\"", :feature => "unlabled", :in_array => false, :in_block => false
|
121
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
122
|
-
assert_nil(c.element.unlabled)
|
123
|
-
end
|
124
|
-
|
125
|
-
def test_root_after_unlabled_string_with_quoted_quote
|
126
|
-
c = build_context TestMM, <<-END
|
127
|
-
TestNode "a,\\"b"|
|
128
|
-
END
|
129
|
-
assert_context c, :prefix => "\"a,\\\"b\"", :feature => "unlabled", :in_array => false, :in_block => false
|
130
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
131
|
-
assert_nil(c.element.unlabled)
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_root_after_unlabled_unclosed_string_with_comma
|
135
|
-
c = build_context TestMM, <<-END
|
136
|
-
TestNode "a,b|
|
137
|
-
END
|
138
|
-
assert_context c, :prefix => "\"a,b", :feature => "unlabled", :in_array => false, :in_block => false
|
139
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
140
|
-
assert_nil(c.element.unlabled)
|
141
|
-
end
|
142
|
-
|
143
|
-
def test_root_after_unlabled_no_quot
|
144
|
-
c = build_context TestMM, <<-END
|
145
|
-
TestNode bla|
|
146
|
-
END
|
147
|
-
assert_context c, :prefix => "bla", :feature => "unlabled", :in_array => false, :in_block => false
|
148
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
149
|
-
assert_nil(c.element.unlabled)
|
150
|
-
end
|
151
|
-
|
152
|
-
def test_root_after_unlabled2
|
153
|
-
c = build_context TestMM, <<-END
|
154
|
-
TestNode "bla" |
|
155
|
-
END
|
156
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
157
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
158
|
-
assert_equal("bla", c.element.unlabled)
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_root_after_unlabled2_no_quot
|
162
|
-
c = build_context TestMM, <<-END
|
163
|
-
TestNode bla |
|
164
|
-
END
|
165
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
166
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
167
|
-
assert_equal("bla", c.element.unlabled)
|
168
|
-
end
|
169
|
-
|
170
|
-
def test_root_after_unlabled_comma_no_quot
|
171
|
-
c = build_context TestMM, <<-END
|
172
|
-
TestNode bla,|
|
173
|
-
END
|
174
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => false, :in_block => false
|
175
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
176
|
-
assert_equal("bla", c.element.unlabled)
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_root_after_unlabled_comma
|
180
|
-
c = build_context TestMM, <<-END
|
181
|
-
TestNode "bla", |
|
182
|
-
END
|
183
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => false, :in_block => false
|
184
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
185
|
-
assert_equal("bla", c.element.unlabled)
|
186
|
-
end
|
187
|
-
|
188
|
-
def test_root_after_unlabled_comma_no_ws
|
189
|
-
c = build_context TestMM, <<-END
|
190
|
-
TestNode "bla",|
|
191
|
-
END
|
192
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => false, :in_block => false
|
193
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
194
|
-
assert_equal("bla", c.element.unlabled)
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_root_unlabled_array
|
198
|
-
c = build_context TestMM, <<-END
|
199
|
-
TestNode "bla", [|
|
200
|
-
END
|
201
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false
|
202
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
203
|
-
assert_equal("bla", c.element.unlabled)
|
204
|
-
assert_equal([], c.element.unlabled_array)
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_root_unlabled_array_first_value
|
208
|
-
c = build_context TestMM, <<-END
|
209
|
-
TestNode "bla", [a|
|
210
|
-
END
|
211
|
-
assert_context c, :prefix => "a", :feature => "unlabled_array", :in_array => true, :in_block => false
|
212
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
213
|
-
assert_equal("bla", c.element.unlabled)
|
214
|
-
assert_equal([], c.element.unlabled_array)
|
215
|
-
end
|
216
|
-
|
217
|
-
def test_root_unlabled_array_first_value_quoted
|
218
|
-
c = build_context TestMM, <<-END
|
219
|
-
TestNode "bla", ["a"|
|
220
|
-
END
|
221
|
-
assert_context c, :prefix => "\"a\"", :feature => "unlabled_array", :in_array => true, :in_block => false
|
222
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
223
|
-
assert_equal("bla", c.element.unlabled)
|
224
|
-
assert_equal([], c.element.unlabled_array)
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_root_unlabled_array_first_value_quoted_open
|
228
|
-
c = build_context TestMM, <<-END
|
229
|
-
TestNode "bla", ["a|
|
230
|
-
END
|
231
|
-
assert_context c, :prefix => "\"a", :feature => "unlabled_array", :in_array => true, :in_block => false
|
232
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
233
|
-
assert_equal("bla", c.element.unlabled)
|
234
|
-
assert_equal([], c.element.unlabled_array)
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_root_unlabled_array_first_value_after_space
|
238
|
-
c = build_context TestMM, <<-END
|
239
|
-
TestNode "bla", ["a" |
|
240
|
-
END
|
241
|
-
# although not having a comma in front is an error, we are already within a feature
|
242
|
-
# due to the opening square bracket
|
243
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false, :problem => :missing_comma
|
244
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
245
|
-
assert_equal("bla", c.element.unlabled)
|
246
|
-
assert_equal(["a"], c.element.unlabled_array)
|
247
|
-
end
|
248
|
-
|
249
|
-
def test_root_unlabled_array_first_value_after_comma
|
250
|
-
c = build_context TestMM, <<-END
|
251
|
-
TestNode "bla", ["a",|
|
252
|
-
END
|
253
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false
|
254
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
255
|
-
assert_equal("bla", c.element.unlabled)
|
256
|
-
assert_equal(["a"], c.element.unlabled_array)
|
257
|
-
end
|
258
|
-
|
259
|
-
def test_root_unlabled_array_second_value
|
260
|
-
c = build_context TestMM, <<-END
|
261
|
-
TestNode "bla", ["a", b|
|
262
|
-
END
|
263
|
-
assert_context c, :prefix => "b", :feature => "unlabled_array", :in_array => true, :in_block => false
|
264
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
265
|
-
assert_equal("bla", c.element.unlabled)
|
266
|
-
assert_equal(["a"], c.element.unlabled_array)
|
267
|
-
end
|
268
|
-
|
269
|
-
def test_root_unlabled_array_second_value_quoted
|
270
|
-
c = build_context TestMM, <<-END
|
271
|
-
TestNode "bla", ["a", "b"|
|
272
|
-
END
|
273
|
-
assert_context c, :prefix => "\"b\"", :feature => "unlabled_array", :in_array => true, :in_block => false
|
274
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
275
|
-
assert_equal("bla", c.element.unlabled)
|
276
|
-
assert_equal(["a"], c.element.unlabled_array)
|
277
|
-
end
|
278
|
-
|
279
|
-
def test_root_unlabled_array_second_value_quoted_open
|
280
|
-
c = build_context TestMM, <<-END
|
281
|
-
TestNode "bla", ["a", "b|
|
282
|
-
END
|
283
|
-
assert_context c, :prefix => "\"b", :feature => "unlabled_array", :in_array => true, :in_block => false
|
284
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
285
|
-
assert_equal("bla", c.element.unlabled)
|
286
|
-
assert_equal(["a"], c.element.unlabled_array)
|
287
|
-
end
|
288
|
-
|
289
|
-
def test_root_unlabled_array_second_value_after_comma
|
290
|
-
c = build_context TestMM, <<-END
|
291
|
-
TestNode "bla", ["a", b,|
|
292
|
-
END
|
293
|
-
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false
|
294
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
295
|
-
assert_equal("bla", c.element.unlabled)
|
296
|
-
assert_equal(["a", "b"], c.element.unlabled_array)
|
297
|
-
end
|
298
|
-
|
299
|
-
def test_root_unlabled_array_after_array
|
300
|
-
c = build_context TestMM, <<-END
|
301
|
-
TestNode "bla", ["a", b]|
|
302
|
-
END
|
303
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
304
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
305
|
-
assert_equal("bla", c.element.unlabled)
|
306
|
-
assert_equal(["a", "b"], c.element.unlabled_array)
|
307
|
-
end
|
308
|
-
|
309
|
-
def test_root_unlabled_array_after_array2
|
310
|
-
c = build_context TestMM, <<-END
|
311
|
-
TestNode "bla", ["a", b] |
|
312
|
-
END
|
313
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
314
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
315
|
-
assert_equal("bla", c.element.unlabled)
|
316
|
-
assert_equal(["a", "b"], c.element.unlabled_array)
|
317
|
-
end
|
318
|
-
|
319
|
-
def test_root_unlabled_array_after_array3
|
320
|
-
c = build_context TestMM, <<-END
|
321
|
-
TestNode "bla", ["a", b],|
|
322
|
-
END
|
323
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
324
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
325
|
-
assert_equal("bla", c.element.unlabled)
|
326
|
-
assert_equal(["a", "b"], c.element.unlabled_array)
|
327
|
-
end
|
328
|
-
|
329
|
-
def test_root_labled_string_value
|
330
|
-
c = build_context TestMM, <<-END
|
331
|
-
TestNode text: "a,b"|
|
332
|
-
END
|
333
|
-
assert_context c, :prefix => "\"a,b\"", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
334
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
335
|
-
assert_nil(c.element.text)
|
336
|
-
end
|
337
|
-
|
338
|
-
def test_root_labled_string_value2
|
339
|
-
c = build_context TestMM, <<-END
|
340
|
-
TestNode text: "a,b" |
|
341
|
-
END
|
342
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
343
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
344
|
-
assert_equal("a,b", c.element.text)
|
345
|
-
end
|
346
|
-
|
347
|
-
def test_root_labled_string_value3
|
348
|
-
c = build_context TestMM, <<-END
|
349
|
-
TestNode text: "a,b",|
|
350
|
-
END
|
351
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
352
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
353
|
-
assert_equal("a,b", c.element.text)
|
354
|
-
end
|
355
|
-
|
356
|
-
def test_root_labled_string_value_within
|
357
|
-
c = build_context TestMM, <<-END
|
358
|
-
TestNode text: "a,b|
|
359
|
-
END
|
360
|
-
assert_context c, :prefix => "\"a,b", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
361
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
362
|
-
assert_nil(c.element.text)
|
363
|
-
end
|
364
|
-
|
365
|
-
def test_root_labled_string_value_within_no_ws
|
366
|
-
c = build_context TestMM, <<-END
|
367
|
-
TestNode text:"a,b|
|
368
|
-
END
|
369
|
-
assert_context c, :prefix => "\"a,b", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
370
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
371
|
-
assert_nil(c.element.text)
|
372
|
-
end
|
373
|
-
|
374
|
-
def test_root_labled_string_value_no_quot
|
375
|
-
c = build_context TestMM, <<-END
|
376
|
-
TestNode text: t|
|
377
|
-
END
|
378
|
-
assert_context c, :prefix => "t", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
379
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
380
|
-
assert_nil(c.element.text)
|
381
|
-
end
|
382
|
-
|
383
|
-
def test_root_labled_bool_value
|
384
|
-
c = build_context TestMM, <<-END
|
385
|
-
TestNode boolean: t|
|
386
|
-
END
|
387
|
-
assert_context c, :prefix => "t", :feature => "boolean", :in_array => false, :in_block => false, :after_label => true
|
388
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
389
|
-
assert_nil(c.element.text)
|
390
|
-
end
|
391
|
-
|
392
|
-
def test_root_after_curly
|
393
|
-
c = build_context TestMM, <<-END
|
394
|
-
TestNode {|
|
395
|
-
END
|
396
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :after_curly
|
397
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
398
|
-
end
|
399
|
-
|
400
|
-
def test_root_after_curly_no_ws
|
401
|
-
c = build_context TestMM, <<-END
|
402
|
-
TestNode{|
|
403
|
-
END
|
404
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :after_curly
|
405
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
406
|
-
end
|
407
|
-
|
408
|
-
def test_in_cmd_after_cmd
|
409
|
-
c = build_context TestMM, <<-END
|
410
|
-
TestNode text: a {
|
411
|
-
TestNode nums: 3 {
|
412
|
-
TestNode |others: /dummy {
|
413
|
-
END
|
414
|
-
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
415
|
-
assert_simple_model(c.element)
|
416
|
-
assert_other_values(c.element, [])
|
417
|
-
end
|
418
|
-
|
419
|
-
def test_in_cmd_after_cmd2
|
420
|
-
c = build_context TestMM, <<-END
|
421
|
-
TestNode text: a {
|
422
|
-
TestNode| nums: 3 {
|
423
|
-
END
|
424
|
-
assert_context c, :prefix => "TestNode", :feature => nil, :in_array => false, :in_block => true
|
425
|
-
assert(c.element.is_a?(TestMM::TestNode))
|
426
|
-
end
|
427
|
-
|
428
|
-
def test_in_cmd_in_label
|
429
|
-
c = build_context TestMM, <<-END
|
430
|
-
TestNode text: a {
|
431
|
-
TestNode nums: 3 {
|
432
|
-
TestNode ot|hers: /dummy {
|
433
|
-
END
|
434
|
-
assert_context c, :prefix => "ot", :feature => "unlabled", :in_array => false, :in_block => false
|
435
|
-
assert_simple_model(c.element)
|
436
|
-
assert_other_values(c.element, [])
|
437
|
-
end
|
438
|
-
|
439
|
-
def test_in_cmd_after_label
|
440
|
-
c = build_context TestMM, <<-END
|
441
|
-
TestNode text: a {
|
442
|
-
TestNode nums: 3 {
|
443
|
-
TestNode others: |/dummy {
|
444
|
-
END
|
445
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
446
|
-
assert_simple_model(c.element)
|
447
|
-
assert_other_values(c.element, [])
|
448
|
-
end
|
449
|
-
|
450
|
-
def test_in_cmd_in_label2
|
451
|
-
c = build_context TestMM, <<-END
|
452
|
-
TestNode text: a {
|
453
|
-
TestNode nums: 3 {
|
454
|
-
TestNode others:| /dummy {
|
455
|
-
END
|
456
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
457
|
-
assert_simple_model(c.element)
|
458
|
-
assert_other_values(c.element, [])
|
459
|
-
end
|
460
|
-
|
461
|
-
def test_in_cmd_after_label_no_ws
|
462
|
-
c = build_context TestMM, <<-END
|
463
|
-
TestNode text: a {
|
464
|
-
TestNode nums: 3 {
|
465
|
-
TestNode others:|/dummy {
|
466
|
-
END
|
467
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
468
|
-
assert_simple_model(c.element)
|
469
|
-
assert_other_values(c.element, [])
|
470
|
-
end
|
471
|
-
|
472
|
-
def test_in_cmd_in_value
|
473
|
-
c = build_context TestMM, <<-END
|
474
|
-
TestNode text: a {
|
475
|
-
TestNode nums: 3 {
|
476
|
-
TestNode others: /du|mmy {
|
477
|
-
END
|
478
|
-
assert_context c, :prefix => "/du", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
479
|
-
assert_simple_model(c.element)
|
480
|
-
assert_other_values(c.element, [])
|
481
|
-
end
|
482
|
-
|
483
|
-
def test_in_cmd_in_value2
|
484
|
-
c = build_context TestMM, <<-END
|
485
|
-
TestNode text: a {
|
486
|
-
TestNode nums: 3 {
|
487
|
-
TestNode others: /dummy| {
|
488
|
-
END
|
489
|
-
assert_context c, :prefix => "/dummy", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
490
|
-
assert_simple_model(c.element)
|
491
|
-
assert_other_values(c.element, [])
|
492
|
-
end
|
493
|
-
|
494
|
-
def test_in_cmd_after_value
|
495
|
-
c = build_context TestMM, <<-END
|
496
|
-
TestNode text: a {
|
497
|
-
TestNode nums: 3 {
|
498
|
-
TestNode others: /dummy, |text: x {
|
499
|
-
END
|
500
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
501
|
-
assert_simple_model(c.element)
|
502
|
-
assert_other_values(c.element, ["/dummy"])
|
503
|
-
end
|
504
|
-
|
505
|
-
def test_in_cmd_after_value_no_ws
|
506
|
-
c = build_context TestMM, <<-END
|
507
|
-
TestNode text: a {
|
508
|
-
TestNode nums: 3 {
|
509
|
-
TestNode others: /dummy,|text: x {
|
510
|
-
END
|
511
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
512
|
-
assert_simple_model(c.element)
|
513
|
-
assert_other_values(c.element, ["/dummy"])
|
514
|
-
end
|
515
|
-
|
516
|
-
def test_in_cmd_after_value_no_ws2
|
517
|
-
c = build_context TestMM, <<-END
|
518
|
-
TestNode text: a {
|
519
|
-
TestNode nums: 3 {
|
520
|
-
TestNode others:/dummy,|text: x {
|
521
|
-
END
|
522
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
523
|
-
assert_simple_model(c.element)
|
524
|
-
assert_other_values(c.element, ["/dummy"])
|
525
|
-
end
|
526
|
-
|
527
|
-
def test_in_cmd_after_value_directly_after_comma
|
528
|
-
c = build_context TestMM, <<-END
|
529
|
-
TestNode text: a {
|
530
|
-
TestNode nums: 3 {
|
531
|
-
TestNode others: /dummy,| text: x {
|
532
|
-
END
|
533
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
534
|
-
assert_simple_model(c.element)
|
535
|
-
assert_other_values(c.element, ["/dummy"])
|
536
|
-
end
|
537
|
-
|
538
|
-
def test_in_cmd_in_second_label
|
539
|
-
c = build_context TestMM, <<-END
|
540
|
-
TestNode text: a {
|
541
|
-
TestNode nums: 3 {
|
542
|
-
TestNode others: /dummy, te|xt: x {
|
543
|
-
END
|
544
|
-
assert_context c, :prefix => "te", :feature => nil, :in_array => false, :in_block => false
|
545
|
-
assert_simple_model(c.element)
|
546
|
-
assert_other_values(c.element, ["/dummy"])
|
547
|
-
end
|
548
|
-
|
549
|
-
def test_in_cmd_after_second_label
|
550
|
-
c = build_context TestMM, <<-END
|
551
|
-
TestNode text: a {
|
552
|
-
TestNode nums: 3 {
|
553
|
-
TestNode others: /dummy, text: |x {
|
554
|
-
END
|
555
|
-
assert_context c, :prefix => "", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
556
|
-
assert_simple_model(c.element)
|
557
|
-
assert_other_values(c.element, ["/dummy"])
|
558
|
-
end
|
559
|
-
|
560
|
-
def test_in_cmd_after_second_label_no_ws
|
561
|
-
c = build_context TestMM, <<-END
|
562
|
-
TestNode text: a {
|
563
|
-
TestNode nums: 3 {
|
564
|
-
TestNode others:/dummy,text:|x {
|
565
|
-
END
|
566
|
-
assert_context c, :prefix => "", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
567
|
-
assert_simple_model(c.element)
|
568
|
-
assert_other_values(c.element, ["/dummy"])
|
569
|
-
end
|
570
|
-
|
571
|
-
def test_in_cmd_in_second_value
|
572
|
-
c = build_context TestMM, <<-END
|
573
|
-
TestNode text: a {
|
574
|
-
TestNode nums: 3 {
|
575
|
-
TestNode others: /dummy, text: x| {
|
576
|
-
END
|
577
|
-
assert_context c, :prefix => "x", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
578
|
-
assert_simple_model(c.element)
|
579
|
-
assert_other_values(c.element, ["/dummy"])
|
580
|
-
end
|
581
|
-
|
582
|
-
def test_in_cmd_in_second_value_no_ws
|
583
|
-
c = build_context TestMM, <<-END
|
584
|
-
TestNode text: a {
|
585
|
-
TestNode nums: 3 {
|
586
|
-
TestNode others:/dummy,text:x| {
|
587
|
-
END
|
588
|
-
assert_context c, :prefix => "x", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
589
|
-
assert_simple_model(c.element)
|
590
|
-
assert_other_values(c.element, ["/dummy"])
|
591
|
-
end
|
592
|
-
|
593
|
-
def test_in_cmd_in_array
|
594
|
-
c = build_context TestMM, <<-END
|
595
|
-
TestNode text: a {
|
596
|
-
TestNode nums: 3 {
|
597
|
-
TestNode others: [|/dummy, text: x
|
598
|
-
END
|
599
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
600
|
-
assert_simple_model(c.element)
|
601
|
-
assert_other_values(c.element, [])
|
602
|
-
end
|
603
|
-
|
604
|
-
def test_in_cmd_in_array_no_ws
|
605
|
-
c = build_context TestMM, <<-END
|
606
|
-
TestNode text: a {
|
607
|
-
TestNode nums: 3 {
|
608
|
-
TestNode others:[|/dummy, text: x
|
609
|
-
END
|
610
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
611
|
-
assert_simple_model(c.element)
|
612
|
-
assert_other_values(c.element, [])
|
613
|
-
end
|
614
|
-
|
615
|
-
def test_in_cmd_in_array_within_string_value_empty
|
616
|
-
c = build_context TestMM, <<-END
|
617
|
-
TestNode text: a {
|
618
|
-
TestNode nums: 3 {
|
619
|
-
TestNode strings: ["|
|
620
|
-
END
|
621
|
-
assert_context c, :prefix => "\"", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
622
|
-
assert_simple_model(c.element)
|
623
|
-
assert_other_values(c.element, [])
|
624
|
-
end
|
625
|
-
|
626
|
-
def test_in_cmd_in_array_within_string_value
|
627
|
-
c = build_context TestMM, <<-END
|
628
|
-
TestNode text: a {
|
629
|
-
TestNode nums: 3 {
|
630
|
-
TestNode strings: ["a,b|
|
631
|
-
END
|
632
|
-
assert_context c, :prefix => "\"a,b", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
633
|
-
assert_simple_model(c.element)
|
634
|
-
assert_other_values(c.element, [])
|
635
|
-
end
|
636
|
-
|
637
|
-
def test_in_cmd_in_array_within_second_string_value
|
638
|
-
c = build_context TestMM, <<-END
|
639
|
-
TestNode text: a {
|
640
|
-
TestNode nums: 3 {
|
641
|
-
TestNode strings: ["a,b", "c,d|
|
642
|
-
END
|
643
|
-
assert_context c, :prefix => "\"c,d", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
644
|
-
assert_simple_model(c.element)
|
645
|
-
assert_other_values(c.element, [])
|
646
|
-
end
|
647
|
-
|
648
|
-
def test_in_cmd_in_array_after_second_string_value
|
649
|
-
c = build_context TestMM, <<-END
|
650
|
-
TestNode text: a {
|
651
|
-
TestNode nums: 3 {
|
652
|
-
TestNode strings: ["a,b", "c,d"|
|
653
|
-
END
|
654
|
-
assert_context c, :prefix => "\"c,d\"", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
655
|
-
assert_simple_model(c.element)
|
656
|
-
assert_equal(["a,b"], c.element.strings)
|
657
|
-
end
|
658
|
-
|
659
|
-
def test_in_cmd_in_array_after_second_string_value2
|
660
|
-
c = build_context TestMM, <<-END
|
661
|
-
TestNode text: a {
|
662
|
-
TestNode nums: 3 {
|
663
|
-
TestNode strings: ["a,b", "c,d" |
|
664
|
-
END
|
665
|
-
assert_context c, :prefix => "", :feature => "strings", :in_array => true, :in_block => false, :problem => :missing_comma, :after_label => true
|
666
|
-
assert_simple_model(c.element)
|
667
|
-
assert_equal(["a,b", "c,d"], c.element.strings)
|
668
|
-
end
|
669
|
-
|
670
|
-
def test_in_cmd_in_array_after_string_array
|
671
|
-
c = build_context TestMM, <<-END
|
672
|
-
TestNode text: a {
|
673
|
-
TestNode nums: 3 {
|
674
|
-
TestNode strings: ["a,b", "c,d"]|
|
675
|
-
END
|
676
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
677
|
-
assert_simple_model(c.element)
|
678
|
-
assert_equal(["a,b", "c,d"], c.element.strings)
|
679
|
-
end
|
680
|
-
|
681
|
-
def test_in_cmd_in_array_value
|
682
|
-
c = build_context TestMM, <<-END
|
683
|
-
TestNode text: a {
|
684
|
-
TestNode nums: 3 {
|
685
|
-
TestNode others: [/d|ummy, text: x
|
686
|
-
END
|
687
|
-
assert_context c, :prefix => "/d", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
688
|
-
assert_simple_model(c.element)
|
689
|
-
assert_other_values(c.element, [])
|
690
|
-
end
|
691
|
-
|
692
|
-
def test_in_cmd_in_array_value_no_ws
|
693
|
-
c = build_context TestMM, <<-END
|
694
|
-
TestNode text: a {
|
695
|
-
TestNode nums: 3 {
|
696
|
-
TestNode others:[/d|ummy, text: x
|
697
|
-
END
|
698
|
-
assert_context c, :prefix => "/d", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
699
|
-
assert_simple_model(c.element)
|
700
|
-
assert_other_values(c.element, [])
|
701
|
-
end
|
702
|
-
|
703
|
-
def test_in_cmd_after_array_value
|
704
|
-
c = build_context TestMM, <<-END
|
705
|
-
TestNode text: a {
|
706
|
-
TestNode nums: 3 {
|
707
|
-
TestNode others: [/dummy,| text: x
|
708
|
-
END
|
709
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
710
|
-
assert_simple_model(c.element)
|
711
|
-
assert_other_values(c.element, ["/dummy"])
|
712
|
-
end
|
713
|
-
|
714
|
-
def test_in_cmd_after_array_value_no_ws
|
715
|
-
c = build_context TestMM, <<-END
|
716
|
-
TestNode text: a {
|
717
|
-
TestNode nums: 3 {
|
718
|
-
TestNode others:[/dummy,| text: x
|
719
|
-
END
|
720
|
-
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
721
|
-
assert_simple_model(c.element)
|
722
|
-
assert_other_values(c.element, ["/dummy"])
|
723
|
-
end
|
724
|
-
|
725
|
-
def test_in_cmd_in_second_array_value
|
726
|
-
c = build_context TestMM, <<-END
|
727
|
-
TestNode text: a {
|
728
|
-
TestNode nums: 3 {
|
729
|
-
TestNode others: [/dummy, /dom|my
|
730
|
-
END
|
731
|
-
assert_context c, :prefix => "/dom", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
732
|
-
assert_simple_model(c.element)
|
733
|
-
assert_other_values(c.element, ["/dummy"])
|
734
|
-
end
|
735
|
-
|
736
|
-
def test_in_cmd_in_second_array_value_no_ws
|
737
|
-
c = build_context TestMM, <<-END
|
738
|
-
TestNode text: a {
|
739
|
-
TestNode nums: 3 {
|
740
|
-
TestNode others: [/dummy,/dom|my
|
741
|
-
END
|
742
|
-
assert_context c, :prefix => "/dom", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
743
|
-
assert_simple_model(c.element)
|
744
|
-
assert_other_values(c.element, ["/dummy"])
|
745
|
-
end
|
746
|
-
|
747
|
-
def test_in_cmd_in_second_array_value_no_ws2
|
748
|
-
c = build_context TestMM, <<-END
|
749
|
-
TestNode text: a {
|
750
|
-
TestNode nums: 3 {
|
751
|
-
TestNode others:[/dummy,/dom|my
|
752
|
-
END
|
753
|
-
assert_context c, :prefix => "/dom", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
754
|
-
assert_simple_model(c.element)
|
755
|
-
assert_other_values(c.element, ["/dummy"])
|
756
|
-
end
|
757
|
-
|
758
|
-
def test_in_cmd_after_array
|
759
|
-
c = build_context TestMM, <<-END
|
760
|
-
TestNode text: a {
|
761
|
-
TestNode nums: 3 {
|
762
|
-
TestNode others: [/dummy, /dommy], |
|
763
|
-
END
|
764
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
765
|
-
assert_simple_model(c.element)
|
766
|
-
assert_other_values(c.element, ["/dummy", "/dommy"])
|
767
|
-
end
|
768
|
-
|
769
|
-
def test_in_cmd_after_array_no_ws
|
770
|
-
c = build_context TestMM, <<-END
|
771
|
-
TestNode text: a {
|
772
|
-
TestNode nums: 3 {
|
773
|
-
TestNode others:[/dummy,/dommy],|
|
774
|
-
END
|
775
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
776
|
-
assert_simple_model(c.element)
|
777
|
-
assert_other_values(c.element, ["/dummy", "/dommy"])
|
778
|
-
end
|
779
|
-
|
780
|
-
def test_in_cmd_after_array2
|
781
|
-
c = build_context TestMM, <<-END
|
782
|
-
TestNode text: a {
|
783
|
-
TestNode nums: 3 {
|
784
|
-
TestNode others: [/dummy, /dommy], nums: |
|
785
|
-
END
|
786
|
-
assert_context c, :prefix => "", :feature => "nums", :in_array => false, :in_block => false, :after_label => true
|
787
|
-
assert_simple_model(c.element)
|
788
|
-
assert_other_values(c.element, ["/dummy", "/dommy"])
|
789
|
-
end
|
790
|
-
|
791
|
-
def test_in_cmd_after_array2_no_ws
|
792
|
-
c = build_context TestMM, <<-END
|
793
|
-
TestNode text: a {
|
794
|
-
TestNode nums: 3 {
|
795
|
-
TestNode others:[/dummy,/dommy],nums:|
|
796
|
-
END
|
797
|
-
assert_context c, :prefix => "", :feature => "nums", :in_array => false, :in_block => false, :after_label => true
|
798
|
-
assert_simple_model(c.element)
|
799
|
-
assert_other_values(c.element, ["/dummy", "/dommy"])
|
800
|
-
end
|
801
|
-
|
802
|
-
def test_in_cmd_boolean_value
|
803
|
-
c = build_context TestMM, <<-END
|
804
|
-
TestNode text: a {
|
805
|
-
TestNode nums: 3 {
|
806
|
-
TestNode boolean: t|
|
807
|
-
END
|
808
|
-
assert_context c, :prefix => "t", :feature => "boolean", :in_array => false, :in_block => false, :after_label => true
|
809
|
-
assert_simple_model(c.element)
|
810
|
-
end
|
811
|
-
|
812
|
-
def test_below_single_label
|
813
|
-
c = build_context TestMM, <<-END
|
814
|
-
TestNode text: a {
|
815
|
-
TestNode nums: 3 {
|
816
|
-
TestNode others: /dummy {
|
817
|
-
childs:
|
818
|
-
|
|
819
|
-
END
|
820
|
-
assert_context c, :prefix => "", :feature => "childs", :in_array => false, :in_block => true, :after_label => true
|
821
|
-
assert_simple_model(c.element)
|
822
|
-
assert_other_values(c.element, ["/dummy"])
|
823
|
-
end
|
824
|
-
|
825
|
-
def test_below_single_label_started_command
|
826
|
-
c = build_context TestMM, <<-END
|
827
|
-
TestNode text: a {
|
828
|
-
TestNode nums: 3 {
|
829
|
-
TestNode others: /dummy {
|
830
|
-
childs:
|
831
|
-
Tes|
|
832
|
-
END
|
833
|
-
assert_context c, :prefix => "Tes", :feature => "childs", :in_array => false, :in_block => true, :after_label => true
|
834
|
-
assert_simple_model(c.element)
|
835
|
-
assert_other_values(c.element, ["/dummy"])
|
836
|
-
end
|
837
|
-
|
838
|
-
def test_below_single_label_after_command
|
839
|
-
c = build_context TestMM, <<-END
|
840
|
-
TestNode text: a {
|
841
|
-
TestNode nums: 3 {
|
842
|
-
TestNode others: /dummy {
|
843
|
-
childs:
|
844
|
-
TestNode |
|
845
|
-
END
|
846
|
-
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
847
|
-
assert_equal [3], c.element.parent.parent.nums
|
848
|
-
end
|
849
|
-
|
850
|
-
def test_below_multi_label
|
851
|
-
c = build_context TestMM, <<-END
|
852
|
-
TestNode text: a {
|
853
|
-
TestNode nums: 3 {
|
854
|
-
TestNode others: /dummy {
|
855
|
-
childs: [
|
856
|
-
|
|
857
|
-
END
|
858
|
-
assert_context c, :prefix => "", :feature => "childs", :in_array => true, :in_block => true, :after_label => true
|
859
|
-
assert_simple_model(c.element)
|
860
|
-
assert_other_values(c.element, ["/dummy"])
|
861
|
-
end
|
862
|
-
|
863
|
-
def test_below_multi_label_started_command
|
864
|
-
c = build_context TestMM, <<-END
|
865
|
-
TestNode text: a {
|
866
|
-
TestNode nums: 3 {
|
867
|
-
TestNode others: /dummy {
|
868
|
-
childs: [
|
869
|
-
Tes|
|
870
|
-
END
|
871
|
-
assert_context c, :prefix => "Tes", :feature => "childs", :in_array => true, :in_block => true, :after_label => true
|
872
|
-
assert_simple_model(c.element)
|
873
|
-
assert_other_values(c.element, ["/dummy"])
|
874
|
-
end
|
875
|
-
|
876
|
-
def test_below_multi_label_after_command
|
877
|
-
c = build_context TestMM, <<-END
|
878
|
-
TestNode text: a {
|
879
|
-
TestNode nums: 3 {
|
880
|
-
TestNode others: /dummy {
|
881
|
-
childs: [
|
882
|
-
TestNode |
|
883
|
-
END
|
884
|
-
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
885
|
-
assert_equal [3], c.element.parent.parent.nums
|
886
|
-
end
|
887
|
-
|
888
|
-
def test_in_new_line
|
889
|
-
c = build_context TestMM, <<-END
|
890
|
-
TestNode text: a {
|
891
|
-
TestNode nums: 3 {
|
892
|
-
TestNode others: /dummy {
|
893
|
-
|
|
894
|
-
END
|
895
|
-
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => true
|
896
|
-
assert_simple_model(c.element)
|
897
|
-
assert_other_values(c.element, ["/dummy"])
|
898
|
-
end
|
899
|
-
|
900
|
-
def test_in_new_line_started_command
|
901
|
-
c = build_context TestMM, <<-END
|
902
|
-
TestNode text: a {
|
903
|
-
TestNode nums: 3 {
|
904
|
-
TestNode others: /dummy {
|
905
|
-
Tes|
|
906
|
-
END
|
907
|
-
assert_context c, :prefix => "Tes", :feature => nil, :in_array => false, :in_block => true
|
908
|
-
assert_simple_model(c.element)
|
909
|
-
assert_other_values(c.element, ["/dummy"])
|
910
|
-
end
|
911
|
-
|
912
|
-
def assert_context(c, options)
|
913
|
-
assert_equal(options[:prefix], c.prefix)
|
914
|
-
assert_equal(options[:in_array], c.in_array)
|
915
|
-
assert_equal(options[:in_block], c.in_block)
|
916
|
-
assert_equal((options[:after_label] || false), c.after_label)
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
assert_equal
|
935
|
-
end
|
936
|
-
|
937
|
-
def
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'rgen/metamodel_builder'
|
5
|
+
require 'rtext/language'
|
6
|
+
require 'rtext/context_builder'
|
7
|
+
|
8
|
+
class ContextBuilderTest < MiniTest::Test
|
9
|
+
|
10
|
+
module TestMM
|
11
|
+
extend RGen::MetamodelBuilder::ModuleExtension
|
12
|
+
class TestNode < RGen::MetamodelBuilder::MMBase
|
13
|
+
has_attr 'text', String
|
14
|
+
has_attr 'unlabled', String
|
15
|
+
has_many_attr 'unlabled_array', String
|
16
|
+
has_many_attr 'nums', Integer
|
17
|
+
has_many_attr 'strings', String
|
18
|
+
has_attr 'boolean', Boolean
|
19
|
+
has_one 'related', TestNode
|
20
|
+
has_many 'others', TestNode
|
21
|
+
contains_many 'childs', TestNode, 'parent'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_root
|
26
|
+
c = build_context TestMM, <<-END
|
27
|
+
|
|
28
|
+
END
|
29
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
30
|
+
assert_nil(c.element)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_root2
|
34
|
+
c = build_context TestMM, <<-END
|
35
|
+
|TestNode
|
36
|
+
END
|
37
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
38
|
+
assert_nil(c.element)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_root_in_cmd
|
42
|
+
c = build_context TestMM, <<-END
|
43
|
+
Test|Node
|
44
|
+
END
|
45
|
+
assert_context c, :prefix => "Test", :feature => nil, :in_array => false, :in_block => false
|
46
|
+
assert_nil(c.element)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_root_after_cmd
|
50
|
+
c = build_context TestMM, <<-END
|
51
|
+
TestNode|
|
52
|
+
END
|
53
|
+
assert_context c, :prefix => "TestNode", :feature => nil, :in_array => false, :in_block => false
|
54
|
+
assert_nil(c.element)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_root_after_cmd2
|
58
|
+
c = build_context TestMM, <<-END
|
59
|
+
TestNode |
|
60
|
+
END
|
61
|
+
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
62
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_root_in_lable
|
66
|
+
c = build_context TestMM, <<-END
|
67
|
+
TestNode ot|hers:
|
68
|
+
END
|
69
|
+
assert_context c, :prefix => "ot", :feature => "unlabled", :in_array => false, :in_block => false
|
70
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_root_after_lable
|
74
|
+
c = build_context TestMM, <<-END
|
75
|
+
TestNode others:|
|
76
|
+
END
|
77
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
78
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_root_after_lable2
|
82
|
+
c = build_context TestMM, <<-END
|
83
|
+
TestNode others: |
|
84
|
+
END
|
85
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
86
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_root_after_lable_with_value
|
90
|
+
c = build_context TestMM, <<-END
|
91
|
+
TestNode text: xx, others: |
|
92
|
+
END
|
93
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
94
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
95
|
+
assert_equal("xx", c.element.text)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_root_after_lable_with_value_missing_comma
|
99
|
+
c = build_context TestMM, <<-END
|
100
|
+
TestNode text: xx others: |
|
101
|
+
END
|
102
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
103
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
104
|
+
assert_equal("xx", c.element.text)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_root_after_unlabled
|
108
|
+
c = build_context TestMM, <<-END
|
109
|
+
TestNode "bla"|
|
110
|
+
END
|
111
|
+
assert_context c, :prefix => "\"bla\"", :feature => "unlabled", :in_array => false, :in_block => false
|
112
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
113
|
+
assert_nil(c.element.unlabled)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_root_after_unlabled_string_with_comma
|
117
|
+
c = build_context TestMM, <<-END
|
118
|
+
TestNode "a,b"|
|
119
|
+
END
|
120
|
+
assert_context c, :prefix => "\"a,b\"", :feature => "unlabled", :in_array => false, :in_block => false
|
121
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
122
|
+
assert_nil(c.element.unlabled)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_root_after_unlabled_string_with_quoted_quote
|
126
|
+
c = build_context TestMM, <<-END
|
127
|
+
TestNode "a,\\"b"|
|
128
|
+
END
|
129
|
+
assert_context c, :prefix => "\"a,\\\"b\"", :feature => "unlabled", :in_array => false, :in_block => false
|
130
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
131
|
+
assert_nil(c.element.unlabled)
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_root_after_unlabled_unclosed_string_with_comma
|
135
|
+
c = build_context TestMM, <<-END
|
136
|
+
TestNode "a,b|
|
137
|
+
END
|
138
|
+
assert_context c, :prefix => "\"a,b", :feature => "unlabled", :in_array => false, :in_block => false
|
139
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
140
|
+
assert_nil(c.element.unlabled)
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_root_after_unlabled_no_quot
|
144
|
+
c = build_context TestMM, <<-END
|
145
|
+
TestNode bla|
|
146
|
+
END
|
147
|
+
assert_context c, :prefix => "bla", :feature => "unlabled", :in_array => false, :in_block => false
|
148
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
149
|
+
assert_nil(c.element.unlabled)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_root_after_unlabled2
|
153
|
+
c = build_context TestMM, <<-END
|
154
|
+
TestNode "bla" |
|
155
|
+
END
|
156
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
157
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
158
|
+
assert_equal("bla", c.element.unlabled)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_root_after_unlabled2_no_quot
|
162
|
+
c = build_context TestMM, <<-END
|
163
|
+
TestNode bla |
|
164
|
+
END
|
165
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
166
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
167
|
+
assert_equal("bla", c.element.unlabled)
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_root_after_unlabled_comma_no_quot
|
171
|
+
c = build_context TestMM, <<-END
|
172
|
+
TestNode bla,|
|
173
|
+
END
|
174
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => false, :in_block => false
|
175
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
176
|
+
assert_equal("bla", c.element.unlabled)
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_root_after_unlabled_comma
|
180
|
+
c = build_context TestMM, <<-END
|
181
|
+
TestNode "bla", |
|
182
|
+
END
|
183
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => false, :in_block => false
|
184
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
185
|
+
assert_equal("bla", c.element.unlabled)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_root_after_unlabled_comma_no_ws
|
189
|
+
c = build_context TestMM, <<-END
|
190
|
+
TestNode "bla",|
|
191
|
+
END
|
192
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => false, :in_block => false
|
193
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
194
|
+
assert_equal("bla", c.element.unlabled)
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_root_unlabled_array
|
198
|
+
c = build_context TestMM, <<-END
|
199
|
+
TestNode "bla", [|
|
200
|
+
END
|
201
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false
|
202
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
203
|
+
assert_equal("bla", c.element.unlabled)
|
204
|
+
assert_equal([], c.element.unlabled_array)
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_root_unlabled_array_first_value
|
208
|
+
c = build_context TestMM, <<-END
|
209
|
+
TestNode "bla", [a|
|
210
|
+
END
|
211
|
+
assert_context c, :prefix => "a", :feature => "unlabled_array", :in_array => true, :in_block => false
|
212
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
213
|
+
assert_equal("bla", c.element.unlabled)
|
214
|
+
assert_equal([], c.element.unlabled_array)
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_root_unlabled_array_first_value_quoted
|
218
|
+
c = build_context TestMM, <<-END
|
219
|
+
TestNode "bla", ["a"|
|
220
|
+
END
|
221
|
+
assert_context c, :prefix => "\"a\"", :feature => "unlabled_array", :in_array => true, :in_block => false
|
222
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
223
|
+
assert_equal("bla", c.element.unlabled)
|
224
|
+
assert_equal([], c.element.unlabled_array)
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_root_unlabled_array_first_value_quoted_open
|
228
|
+
c = build_context TestMM, <<-END
|
229
|
+
TestNode "bla", ["a|
|
230
|
+
END
|
231
|
+
assert_context c, :prefix => "\"a", :feature => "unlabled_array", :in_array => true, :in_block => false
|
232
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
233
|
+
assert_equal("bla", c.element.unlabled)
|
234
|
+
assert_equal([], c.element.unlabled_array)
|
235
|
+
end
|
236
|
+
|
237
|
+
def test_root_unlabled_array_first_value_after_space
|
238
|
+
c = build_context TestMM, <<-END
|
239
|
+
TestNode "bla", ["a" |
|
240
|
+
END
|
241
|
+
# although not having a comma in front is an error, we are already within a feature
|
242
|
+
# due to the opening square bracket
|
243
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false, :problem => :missing_comma
|
244
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
245
|
+
assert_equal("bla", c.element.unlabled)
|
246
|
+
assert_equal(["a"], c.element.unlabled_array)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_root_unlabled_array_first_value_after_comma
|
250
|
+
c = build_context TestMM, <<-END
|
251
|
+
TestNode "bla", ["a",|
|
252
|
+
END
|
253
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false
|
254
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
255
|
+
assert_equal("bla", c.element.unlabled)
|
256
|
+
assert_equal(["a"], c.element.unlabled_array)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_root_unlabled_array_second_value
|
260
|
+
c = build_context TestMM, <<-END
|
261
|
+
TestNode "bla", ["a", b|
|
262
|
+
END
|
263
|
+
assert_context c, :prefix => "b", :feature => "unlabled_array", :in_array => true, :in_block => false
|
264
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
265
|
+
assert_equal("bla", c.element.unlabled)
|
266
|
+
assert_equal(["a"], c.element.unlabled_array)
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_root_unlabled_array_second_value_quoted
|
270
|
+
c = build_context TestMM, <<-END
|
271
|
+
TestNode "bla", ["a", "b"|
|
272
|
+
END
|
273
|
+
assert_context c, :prefix => "\"b\"", :feature => "unlabled_array", :in_array => true, :in_block => false
|
274
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
275
|
+
assert_equal("bla", c.element.unlabled)
|
276
|
+
assert_equal(["a"], c.element.unlabled_array)
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_root_unlabled_array_second_value_quoted_open
|
280
|
+
c = build_context TestMM, <<-END
|
281
|
+
TestNode "bla", ["a", "b|
|
282
|
+
END
|
283
|
+
assert_context c, :prefix => "\"b", :feature => "unlabled_array", :in_array => true, :in_block => false
|
284
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
285
|
+
assert_equal("bla", c.element.unlabled)
|
286
|
+
assert_equal(["a"], c.element.unlabled_array)
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_root_unlabled_array_second_value_after_comma
|
290
|
+
c = build_context TestMM, <<-END
|
291
|
+
TestNode "bla", ["a", b,|
|
292
|
+
END
|
293
|
+
assert_context c, :prefix => "", :feature => "unlabled_array", :in_array => true, :in_block => false
|
294
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
295
|
+
assert_equal("bla", c.element.unlabled)
|
296
|
+
assert_equal(["a", "b"], c.element.unlabled_array)
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_root_unlabled_array_after_array
|
300
|
+
c = build_context TestMM, <<-END
|
301
|
+
TestNode "bla", ["a", b]|
|
302
|
+
END
|
303
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
304
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
305
|
+
assert_equal("bla", c.element.unlabled)
|
306
|
+
assert_equal(["a", "b"], c.element.unlabled_array)
|
307
|
+
end
|
308
|
+
|
309
|
+
def test_root_unlabled_array_after_array2
|
310
|
+
c = build_context TestMM, <<-END
|
311
|
+
TestNode "bla", ["a", b] |
|
312
|
+
END
|
313
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
314
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
315
|
+
assert_equal("bla", c.element.unlabled)
|
316
|
+
assert_equal(["a", "b"], c.element.unlabled_array)
|
317
|
+
end
|
318
|
+
|
319
|
+
def test_root_unlabled_array_after_array3
|
320
|
+
c = build_context TestMM, <<-END
|
321
|
+
TestNode "bla", ["a", b],|
|
322
|
+
END
|
323
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
324
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
325
|
+
assert_equal("bla", c.element.unlabled)
|
326
|
+
assert_equal(["a", "b"], c.element.unlabled_array)
|
327
|
+
end
|
328
|
+
|
329
|
+
def test_root_labled_string_value
|
330
|
+
c = build_context TestMM, <<-END
|
331
|
+
TestNode text: "a,b"|
|
332
|
+
END
|
333
|
+
assert_context c, :prefix => "\"a,b\"", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
334
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
335
|
+
assert_nil(c.element.text)
|
336
|
+
end
|
337
|
+
|
338
|
+
def test_root_labled_string_value2
|
339
|
+
c = build_context TestMM, <<-END
|
340
|
+
TestNode text: "a,b" |
|
341
|
+
END
|
342
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
343
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
344
|
+
assert_equal("a,b", c.element.text)
|
345
|
+
end
|
346
|
+
|
347
|
+
def test_root_labled_string_value3
|
348
|
+
c = build_context TestMM, <<-END
|
349
|
+
TestNode text: "a,b",|
|
350
|
+
END
|
351
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
352
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
353
|
+
assert_equal("a,b", c.element.text)
|
354
|
+
end
|
355
|
+
|
356
|
+
def test_root_labled_string_value_within
|
357
|
+
c = build_context TestMM, <<-END
|
358
|
+
TestNode text: "a,b|
|
359
|
+
END
|
360
|
+
assert_context c, :prefix => "\"a,b", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
361
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
362
|
+
assert_nil(c.element.text)
|
363
|
+
end
|
364
|
+
|
365
|
+
def test_root_labled_string_value_within_no_ws
|
366
|
+
c = build_context TestMM, <<-END
|
367
|
+
TestNode text:"a,b|
|
368
|
+
END
|
369
|
+
assert_context c, :prefix => "\"a,b", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
370
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
371
|
+
assert_nil(c.element.text)
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_root_labled_string_value_no_quot
|
375
|
+
c = build_context TestMM, <<-END
|
376
|
+
TestNode text: t|
|
377
|
+
END
|
378
|
+
assert_context c, :prefix => "t", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
379
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
380
|
+
assert_nil(c.element.text)
|
381
|
+
end
|
382
|
+
|
383
|
+
def test_root_labled_bool_value
|
384
|
+
c = build_context TestMM, <<-END
|
385
|
+
TestNode boolean: t|
|
386
|
+
END
|
387
|
+
assert_context c, :prefix => "t", :feature => "boolean", :in_array => false, :in_block => false, :after_label => true
|
388
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
389
|
+
assert_nil(c.element.text)
|
390
|
+
end
|
391
|
+
|
392
|
+
def test_root_after_curly
|
393
|
+
c = build_context TestMM, <<-END
|
394
|
+
TestNode {|
|
395
|
+
END
|
396
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :after_curly
|
397
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
398
|
+
end
|
399
|
+
|
400
|
+
def test_root_after_curly_no_ws
|
401
|
+
c = build_context TestMM, <<-END
|
402
|
+
TestNode{|
|
403
|
+
END
|
404
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :after_curly
|
405
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
406
|
+
end
|
407
|
+
|
408
|
+
def test_in_cmd_after_cmd
|
409
|
+
c = build_context TestMM, <<-END
|
410
|
+
TestNode text: a {
|
411
|
+
TestNode nums: 3 {
|
412
|
+
TestNode |others: /dummy {
|
413
|
+
END
|
414
|
+
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
415
|
+
assert_simple_model(c.element)
|
416
|
+
assert_other_values(c.element, [])
|
417
|
+
end
|
418
|
+
|
419
|
+
def test_in_cmd_after_cmd2
|
420
|
+
c = build_context TestMM, <<-END
|
421
|
+
TestNode text: a {
|
422
|
+
TestNode| nums: 3 {
|
423
|
+
END
|
424
|
+
assert_context c, :prefix => "TestNode", :feature => nil, :in_array => false, :in_block => true
|
425
|
+
assert(c.element.is_a?(TestMM::TestNode))
|
426
|
+
end
|
427
|
+
|
428
|
+
def test_in_cmd_in_label
|
429
|
+
c = build_context TestMM, <<-END
|
430
|
+
TestNode text: a {
|
431
|
+
TestNode nums: 3 {
|
432
|
+
TestNode ot|hers: /dummy {
|
433
|
+
END
|
434
|
+
assert_context c, :prefix => "ot", :feature => "unlabled", :in_array => false, :in_block => false
|
435
|
+
assert_simple_model(c.element)
|
436
|
+
assert_other_values(c.element, [])
|
437
|
+
end
|
438
|
+
|
439
|
+
def test_in_cmd_after_label
|
440
|
+
c = build_context TestMM, <<-END
|
441
|
+
TestNode text: a {
|
442
|
+
TestNode nums: 3 {
|
443
|
+
TestNode others: |/dummy {
|
444
|
+
END
|
445
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
446
|
+
assert_simple_model(c.element)
|
447
|
+
assert_other_values(c.element, [])
|
448
|
+
end
|
449
|
+
|
450
|
+
def test_in_cmd_in_label2
|
451
|
+
c = build_context TestMM, <<-END
|
452
|
+
TestNode text: a {
|
453
|
+
TestNode nums: 3 {
|
454
|
+
TestNode others:| /dummy {
|
455
|
+
END
|
456
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
457
|
+
assert_simple_model(c.element)
|
458
|
+
assert_other_values(c.element, [])
|
459
|
+
end
|
460
|
+
|
461
|
+
def test_in_cmd_after_label_no_ws
|
462
|
+
c = build_context TestMM, <<-END
|
463
|
+
TestNode text: a {
|
464
|
+
TestNode nums: 3 {
|
465
|
+
TestNode others:|/dummy {
|
466
|
+
END
|
467
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
468
|
+
assert_simple_model(c.element)
|
469
|
+
assert_other_values(c.element, [])
|
470
|
+
end
|
471
|
+
|
472
|
+
def test_in_cmd_in_value
|
473
|
+
c = build_context TestMM, <<-END
|
474
|
+
TestNode text: a {
|
475
|
+
TestNode nums: 3 {
|
476
|
+
TestNode others: /du|mmy {
|
477
|
+
END
|
478
|
+
assert_context c, :prefix => "/du", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
479
|
+
assert_simple_model(c.element)
|
480
|
+
assert_other_values(c.element, [])
|
481
|
+
end
|
482
|
+
|
483
|
+
def test_in_cmd_in_value2
|
484
|
+
c = build_context TestMM, <<-END
|
485
|
+
TestNode text: a {
|
486
|
+
TestNode nums: 3 {
|
487
|
+
TestNode others: /dummy| {
|
488
|
+
END
|
489
|
+
assert_context c, :prefix => "/dummy", :feature => "others", :in_array => false, :in_block => false, :after_label => true
|
490
|
+
assert_simple_model(c.element)
|
491
|
+
assert_other_values(c.element, [])
|
492
|
+
end
|
493
|
+
|
494
|
+
def test_in_cmd_after_value
|
495
|
+
c = build_context TestMM, <<-END
|
496
|
+
TestNode text: a {
|
497
|
+
TestNode nums: 3 {
|
498
|
+
TestNode others: /dummy, |text: x {
|
499
|
+
END
|
500
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
501
|
+
assert_simple_model(c.element)
|
502
|
+
assert_other_values(c.element, ["/dummy"])
|
503
|
+
end
|
504
|
+
|
505
|
+
def test_in_cmd_after_value_no_ws
|
506
|
+
c = build_context TestMM, <<-END
|
507
|
+
TestNode text: a {
|
508
|
+
TestNode nums: 3 {
|
509
|
+
TestNode others: /dummy,|text: x {
|
510
|
+
END
|
511
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
512
|
+
assert_simple_model(c.element)
|
513
|
+
assert_other_values(c.element, ["/dummy"])
|
514
|
+
end
|
515
|
+
|
516
|
+
def test_in_cmd_after_value_no_ws2
|
517
|
+
c = build_context TestMM, <<-END
|
518
|
+
TestNode text: a {
|
519
|
+
TestNode nums: 3 {
|
520
|
+
TestNode others:/dummy,|text: x {
|
521
|
+
END
|
522
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
523
|
+
assert_simple_model(c.element)
|
524
|
+
assert_other_values(c.element, ["/dummy"])
|
525
|
+
end
|
526
|
+
|
527
|
+
def test_in_cmd_after_value_directly_after_comma
|
528
|
+
c = build_context TestMM, <<-END
|
529
|
+
TestNode text: a {
|
530
|
+
TestNode nums: 3 {
|
531
|
+
TestNode others: /dummy,| text: x {
|
532
|
+
END
|
533
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
534
|
+
assert_simple_model(c.element)
|
535
|
+
assert_other_values(c.element, ["/dummy"])
|
536
|
+
end
|
537
|
+
|
538
|
+
def test_in_cmd_in_second_label
|
539
|
+
c = build_context TestMM, <<-END
|
540
|
+
TestNode text: a {
|
541
|
+
TestNode nums: 3 {
|
542
|
+
TestNode others: /dummy, te|xt: x {
|
543
|
+
END
|
544
|
+
assert_context c, :prefix => "te", :feature => nil, :in_array => false, :in_block => false
|
545
|
+
assert_simple_model(c.element)
|
546
|
+
assert_other_values(c.element, ["/dummy"])
|
547
|
+
end
|
548
|
+
|
549
|
+
def test_in_cmd_after_second_label
|
550
|
+
c = build_context TestMM, <<-END
|
551
|
+
TestNode text: a {
|
552
|
+
TestNode nums: 3 {
|
553
|
+
TestNode others: /dummy, text: |x {
|
554
|
+
END
|
555
|
+
assert_context c, :prefix => "", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
556
|
+
assert_simple_model(c.element)
|
557
|
+
assert_other_values(c.element, ["/dummy"])
|
558
|
+
end
|
559
|
+
|
560
|
+
def test_in_cmd_after_second_label_no_ws
|
561
|
+
c = build_context TestMM, <<-END
|
562
|
+
TestNode text: a {
|
563
|
+
TestNode nums: 3 {
|
564
|
+
TestNode others:/dummy,text:|x {
|
565
|
+
END
|
566
|
+
assert_context c, :prefix => "", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
567
|
+
assert_simple_model(c.element)
|
568
|
+
assert_other_values(c.element, ["/dummy"])
|
569
|
+
end
|
570
|
+
|
571
|
+
def test_in_cmd_in_second_value
|
572
|
+
c = build_context TestMM, <<-END
|
573
|
+
TestNode text: a {
|
574
|
+
TestNode nums: 3 {
|
575
|
+
TestNode others: /dummy, text: x| {
|
576
|
+
END
|
577
|
+
assert_context c, :prefix => "x", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
578
|
+
assert_simple_model(c.element)
|
579
|
+
assert_other_values(c.element, ["/dummy"])
|
580
|
+
end
|
581
|
+
|
582
|
+
def test_in_cmd_in_second_value_no_ws
|
583
|
+
c = build_context TestMM, <<-END
|
584
|
+
TestNode text: a {
|
585
|
+
TestNode nums: 3 {
|
586
|
+
TestNode others:/dummy,text:x| {
|
587
|
+
END
|
588
|
+
assert_context c, :prefix => "x", :feature => "text", :in_array => false, :in_block => false, :after_label => true
|
589
|
+
assert_simple_model(c.element)
|
590
|
+
assert_other_values(c.element, ["/dummy"])
|
591
|
+
end
|
592
|
+
|
593
|
+
def test_in_cmd_in_array
|
594
|
+
c = build_context TestMM, <<-END
|
595
|
+
TestNode text: a {
|
596
|
+
TestNode nums: 3 {
|
597
|
+
TestNode others: [|/dummy, text: x
|
598
|
+
END
|
599
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
600
|
+
assert_simple_model(c.element)
|
601
|
+
assert_other_values(c.element, [])
|
602
|
+
end
|
603
|
+
|
604
|
+
def test_in_cmd_in_array_no_ws
|
605
|
+
c = build_context TestMM, <<-END
|
606
|
+
TestNode text: a {
|
607
|
+
TestNode nums: 3 {
|
608
|
+
TestNode others:[|/dummy, text: x
|
609
|
+
END
|
610
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
611
|
+
assert_simple_model(c.element)
|
612
|
+
assert_other_values(c.element, [])
|
613
|
+
end
|
614
|
+
|
615
|
+
def test_in_cmd_in_array_within_string_value_empty
|
616
|
+
c = build_context TestMM, <<-END
|
617
|
+
TestNode text: a {
|
618
|
+
TestNode nums: 3 {
|
619
|
+
TestNode strings: ["|
|
620
|
+
END
|
621
|
+
assert_context c, :prefix => "\"", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
622
|
+
assert_simple_model(c.element)
|
623
|
+
assert_other_values(c.element, [])
|
624
|
+
end
|
625
|
+
|
626
|
+
def test_in_cmd_in_array_within_string_value
|
627
|
+
c = build_context TestMM, <<-END
|
628
|
+
TestNode text: a {
|
629
|
+
TestNode nums: 3 {
|
630
|
+
TestNode strings: ["a,b|
|
631
|
+
END
|
632
|
+
assert_context c, :prefix => "\"a,b", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
633
|
+
assert_simple_model(c.element)
|
634
|
+
assert_other_values(c.element, [])
|
635
|
+
end
|
636
|
+
|
637
|
+
def test_in_cmd_in_array_within_second_string_value
|
638
|
+
c = build_context TestMM, <<-END
|
639
|
+
TestNode text: a {
|
640
|
+
TestNode nums: 3 {
|
641
|
+
TestNode strings: ["a,b", "c,d|
|
642
|
+
END
|
643
|
+
assert_context c, :prefix => "\"c,d", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
644
|
+
assert_simple_model(c.element)
|
645
|
+
assert_other_values(c.element, [])
|
646
|
+
end
|
647
|
+
|
648
|
+
def test_in_cmd_in_array_after_second_string_value
|
649
|
+
c = build_context TestMM, <<-END
|
650
|
+
TestNode text: a {
|
651
|
+
TestNode nums: 3 {
|
652
|
+
TestNode strings: ["a,b", "c,d"|
|
653
|
+
END
|
654
|
+
assert_context c, :prefix => "\"c,d\"", :feature => "strings", :in_array => true, :in_block => false, :after_label => true
|
655
|
+
assert_simple_model(c.element)
|
656
|
+
assert_equal(["a,b"], c.element.strings)
|
657
|
+
end
|
658
|
+
|
659
|
+
def test_in_cmd_in_array_after_second_string_value2
|
660
|
+
c = build_context TestMM, <<-END
|
661
|
+
TestNode text: a {
|
662
|
+
TestNode nums: 3 {
|
663
|
+
TestNode strings: ["a,b", "c,d" |
|
664
|
+
END
|
665
|
+
assert_context c, :prefix => "", :feature => "strings", :in_array => true, :in_block => false, :problem => :missing_comma, :after_label => true
|
666
|
+
assert_simple_model(c.element)
|
667
|
+
assert_equal(["a,b", "c,d"], c.element.strings)
|
668
|
+
end
|
669
|
+
|
670
|
+
def test_in_cmd_in_array_after_string_array
|
671
|
+
c = build_context TestMM, <<-END
|
672
|
+
TestNode text: a {
|
673
|
+
TestNode nums: 3 {
|
674
|
+
TestNode strings: ["a,b", "c,d"]|
|
675
|
+
END
|
676
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false, :problem => :missing_comma
|
677
|
+
assert_simple_model(c.element)
|
678
|
+
assert_equal(["a,b", "c,d"], c.element.strings)
|
679
|
+
end
|
680
|
+
|
681
|
+
def test_in_cmd_in_array_value
|
682
|
+
c = build_context TestMM, <<-END
|
683
|
+
TestNode text: a {
|
684
|
+
TestNode nums: 3 {
|
685
|
+
TestNode others: [/d|ummy, text: x
|
686
|
+
END
|
687
|
+
assert_context c, :prefix => "/d", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
688
|
+
assert_simple_model(c.element)
|
689
|
+
assert_other_values(c.element, [])
|
690
|
+
end
|
691
|
+
|
692
|
+
def test_in_cmd_in_array_value_no_ws
|
693
|
+
c = build_context TestMM, <<-END
|
694
|
+
TestNode text: a {
|
695
|
+
TestNode nums: 3 {
|
696
|
+
TestNode others:[/d|ummy, text: x
|
697
|
+
END
|
698
|
+
assert_context c, :prefix => "/d", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
699
|
+
assert_simple_model(c.element)
|
700
|
+
assert_other_values(c.element, [])
|
701
|
+
end
|
702
|
+
|
703
|
+
def test_in_cmd_after_array_value
|
704
|
+
c = build_context TestMM, <<-END
|
705
|
+
TestNode text: a {
|
706
|
+
TestNode nums: 3 {
|
707
|
+
TestNode others: [/dummy,| text: x
|
708
|
+
END
|
709
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
710
|
+
assert_simple_model(c.element)
|
711
|
+
assert_other_values(c.element, ["/dummy"])
|
712
|
+
end
|
713
|
+
|
714
|
+
def test_in_cmd_after_array_value_no_ws
|
715
|
+
c = build_context TestMM, <<-END
|
716
|
+
TestNode text: a {
|
717
|
+
TestNode nums: 3 {
|
718
|
+
TestNode others:[/dummy,| text: x
|
719
|
+
END
|
720
|
+
assert_context c, :prefix => "", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
721
|
+
assert_simple_model(c.element)
|
722
|
+
assert_other_values(c.element, ["/dummy"])
|
723
|
+
end
|
724
|
+
|
725
|
+
def test_in_cmd_in_second_array_value
|
726
|
+
c = build_context TestMM, <<-END
|
727
|
+
TestNode text: a {
|
728
|
+
TestNode nums: 3 {
|
729
|
+
TestNode others: [/dummy, /dom|my
|
730
|
+
END
|
731
|
+
assert_context c, :prefix => "/dom", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
732
|
+
assert_simple_model(c.element)
|
733
|
+
assert_other_values(c.element, ["/dummy"])
|
734
|
+
end
|
735
|
+
|
736
|
+
def test_in_cmd_in_second_array_value_no_ws
|
737
|
+
c = build_context TestMM, <<-END
|
738
|
+
TestNode text: a {
|
739
|
+
TestNode nums: 3 {
|
740
|
+
TestNode others: [/dummy,/dom|my
|
741
|
+
END
|
742
|
+
assert_context c, :prefix => "/dom", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
743
|
+
assert_simple_model(c.element)
|
744
|
+
assert_other_values(c.element, ["/dummy"])
|
745
|
+
end
|
746
|
+
|
747
|
+
def test_in_cmd_in_second_array_value_no_ws2
|
748
|
+
c = build_context TestMM, <<-END
|
749
|
+
TestNode text: a {
|
750
|
+
TestNode nums: 3 {
|
751
|
+
TestNode others:[/dummy,/dom|my
|
752
|
+
END
|
753
|
+
assert_context c, :prefix => "/dom", :feature => "others", :in_array => true, :in_block => false, :after_label => true
|
754
|
+
assert_simple_model(c.element)
|
755
|
+
assert_other_values(c.element, ["/dummy"])
|
756
|
+
end
|
757
|
+
|
758
|
+
def test_in_cmd_after_array
|
759
|
+
c = build_context TestMM, <<-END
|
760
|
+
TestNode text: a {
|
761
|
+
TestNode nums: 3 {
|
762
|
+
TestNode others: [/dummy, /dommy], |
|
763
|
+
END
|
764
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
765
|
+
assert_simple_model(c.element)
|
766
|
+
assert_other_values(c.element, ["/dummy", "/dommy"])
|
767
|
+
end
|
768
|
+
|
769
|
+
def test_in_cmd_after_array_no_ws
|
770
|
+
c = build_context TestMM, <<-END
|
771
|
+
TestNode text: a {
|
772
|
+
TestNode nums: 3 {
|
773
|
+
TestNode others:[/dummy,/dommy],|
|
774
|
+
END
|
775
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => false
|
776
|
+
assert_simple_model(c.element)
|
777
|
+
assert_other_values(c.element, ["/dummy", "/dommy"])
|
778
|
+
end
|
779
|
+
|
780
|
+
def test_in_cmd_after_array2
|
781
|
+
c = build_context TestMM, <<-END
|
782
|
+
TestNode text: a {
|
783
|
+
TestNode nums: 3 {
|
784
|
+
TestNode others: [/dummy, /dommy], nums: |
|
785
|
+
END
|
786
|
+
assert_context c, :prefix => "", :feature => "nums", :in_array => false, :in_block => false, :after_label => true
|
787
|
+
assert_simple_model(c.element)
|
788
|
+
assert_other_values(c.element, ["/dummy", "/dommy"])
|
789
|
+
end
|
790
|
+
|
791
|
+
def test_in_cmd_after_array2_no_ws
|
792
|
+
c = build_context TestMM, <<-END
|
793
|
+
TestNode text: a {
|
794
|
+
TestNode nums: 3 {
|
795
|
+
TestNode others:[/dummy,/dommy],nums:|
|
796
|
+
END
|
797
|
+
assert_context c, :prefix => "", :feature => "nums", :in_array => false, :in_block => false, :after_label => true
|
798
|
+
assert_simple_model(c.element)
|
799
|
+
assert_other_values(c.element, ["/dummy", "/dommy"])
|
800
|
+
end
|
801
|
+
|
802
|
+
def test_in_cmd_boolean_value
|
803
|
+
c = build_context TestMM, <<-END
|
804
|
+
TestNode text: a {
|
805
|
+
TestNode nums: 3 {
|
806
|
+
TestNode boolean: t|
|
807
|
+
END
|
808
|
+
assert_context c, :prefix => "t", :feature => "boolean", :in_array => false, :in_block => false, :after_label => true
|
809
|
+
assert_simple_model(c.element)
|
810
|
+
end
|
811
|
+
|
812
|
+
def test_below_single_label
|
813
|
+
c = build_context TestMM, <<-END
|
814
|
+
TestNode text: a {
|
815
|
+
TestNode nums: 3 {
|
816
|
+
TestNode others: /dummy {
|
817
|
+
childs:
|
818
|
+
|
|
819
|
+
END
|
820
|
+
assert_context c, :prefix => "", :feature => "childs", :in_array => false, :in_block => true, :after_label => true
|
821
|
+
assert_simple_model(c.element)
|
822
|
+
assert_other_values(c.element, ["/dummy"])
|
823
|
+
end
|
824
|
+
|
825
|
+
def test_below_single_label_started_command
|
826
|
+
c = build_context TestMM, <<-END
|
827
|
+
TestNode text: a {
|
828
|
+
TestNode nums: 3 {
|
829
|
+
TestNode others: /dummy {
|
830
|
+
childs:
|
831
|
+
Tes|
|
832
|
+
END
|
833
|
+
assert_context c, :prefix => "Tes", :feature => "childs", :in_array => false, :in_block => true, :after_label => true
|
834
|
+
assert_simple_model(c.element)
|
835
|
+
assert_other_values(c.element, ["/dummy"])
|
836
|
+
end
|
837
|
+
|
838
|
+
def test_below_single_label_after_command
|
839
|
+
c = build_context TestMM, <<-END
|
840
|
+
TestNode text: a {
|
841
|
+
TestNode nums: 3 {
|
842
|
+
TestNode others: /dummy {
|
843
|
+
childs:
|
844
|
+
TestNode |
|
845
|
+
END
|
846
|
+
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
847
|
+
assert_equal [3], c.element.parent.parent.nums
|
848
|
+
end
|
849
|
+
|
850
|
+
def test_below_multi_label
|
851
|
+
c = build_context TestMM, <<-END
|
852
|
+
TestNode text: a {
|
853
|
+
TestNode nums: 3 {
|
854
|
+
TestNode others: /dummy {
|
855
|
+
childs: [
|
856
|
+
|
|
857
|
+
END
|
858
|
+
assert_context c, :prefix => "", :feature => "childs", :in_array => true, :in_block => true, :after_label => true
|
859
|
+
assert_simple_model(c.element)
|
860
|
+
assert_other_values(c.element, ["/dummy"])
|
861
|
+
end
|
862
|
+
|
863
|
+
def test_below_multi_label_started_command
|
864
|
+
c = build_context TestMM, <<-END
|
865
|
+
TestNode text: a {
|
866
|
+
TestNode nums: 3 {
|
867
|
+
TestNode others: /dummy {
|
868
|
+
childs: [
|
869
|
+
Tes|
|
870
|
+
END
|
871
|
+
assert_context c, :prefix => "Tes", :feature => "childs", :in_array => true, :in_block => true, :after_label => true
|
872
|
+
assert_simple_model(c.element)
|
873
|
+
assert_other_values(c.element, ["/dummy"])
|
874
|
+
end
|
875
|
+
|
876
|
+
def test_below_multi_label_after_command
|
877
|
+
c = build_context TestMM, <<-END
|
878
|
+
TestNode text: a {
|
879
|
+
TestNode nums: 3 {
|
880
|
+
TestNode others: /dummy {
|
881
|
+
childs: [
|
882
|
+
TestNode |
|
883
|
+
END
|
884
|
+
assert_context c, :prefix => "", :feature => "unlabled", :in_array => false, :in_block => false
|
885
|
+
assert_equal [3], c.element.parent.parent.nums
|
886
|
+
end
|
887
|
+
|
888
|
+
def test_in_new_line
|
889
|
+
c = build_context TestMM, <<-END
|
890
|
+
TestNode text: a {
|
891
|
+
TestNode nums: 3 {
|
892
|
+
TestNode others: /dummy {
|
893
|
+
|
|
894
|
+
END
|
895
|
+
assert_context c, :prefix => "", :feature => nil, :in_array => false, :in_block => true
|
896
|
+
assert_simple_model(c.element)
|
897
|
+
assert_other_values(c.element, ["/dummy"])
|
898
|
+
end
|
899
|
+
|
900
|
+
def test_in_new_line_started_command
|
901
|
+
c = build_context TestMM, <<-END
|
902
|
+
TestNode text: a {
|
903
|
+
TestNode nums: 3 {
|
904
|
+
TestNode others: /dummy {
|
905
|
+
Tes|
|
906
|
+
END
|
907
|
+
assert_context c, :prefix => "Tes", :feature => nil, :in_array => false, :in_block => true
|
908
|
+
assert_simple_model(c.element)
|
909
|
+
assert_other_values(c.element, ["/dummy"])
|
910
|
+
end
|
911
|
+
|
912
|
+
def assert_context(c, options)
|
913
|
+
assert_equal(options[:prefix], c.prefix)
|
914
|
+
assert_equal(options[:in_array], c.position.in_array)
|
915
|
+
assert_equal(options[:in_block], c.position.in_block)
|
916
|
+
assert_equal((options[:after_label] || false), c.position.after_label)
|
917
|
+
if options[:problem]
|
918
|
+
assert_equal(options[:problem], c.problem)
|
919
|
+
else
|
920
|
+
assert_nil(c.problem)
|
921
|
+
end
|
922
|
+
if options[:feature]
|
923
|
+
assert_equal(options[:feature], c.feature.name)
|
924
|
+
else
|
925
|
+
assert_nil(c.feature)
|
926
|
+
end
|
927
|
+
end
|
928
|
+
|
929
|
+
def assert_simple_model(c)
|
930
|
+
assert c.is_a?(TestMM::TestNode)
|
931
|
+
assert c.parent.is_a?(TestMM::TestNode)
|
932
|
+
assert_equal [3], c.parent.nums
|
933
|
+
assert c.parent.parent.is_a?(TestMM::TestNode)
|
934
|
+
assert_equal "a", c.parent.parent.text
|
935
|
+
end
|
936
|
+
|
937
|
+
def assert_other_values(c, values)
|
938
|
+
assert_equal values, c.others.collect{|v| v.targetIdentifier}
|
939
|
+
end
|
940
|
+
|
941
|
+
def build_context(mm, text)
|
942
|
+
context_lines = text.split("\n")
|
943
|
+
pos_in_line = context_lines.last.index("|")
|
944
|
+
context_lines.last.sub!("|", "")
|
945
|
+
lang = RText::Language.new(mm.ecore,
|
946
|
+
:root_classes => mm.ecore.eAllClasses,
|
947
|
+
:unlabled_arguments => lambda {|c| ["unlabled", "unlabled_array"]})
|
948
|
+
RText::ContextBuilder.build_context(lang, context_lines, pos_in_line)
|
949
|
+
end
|
950
|
+
|
951
|
+
end
|
952
|
+
|