rtext 0.9.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +113 -98
  3. data/Project.yaml +14 -0
  4. data/RText_Protocol +1 -1
  5. data/lib/rtext/default_completer.rb +212 -208
  6. data/lib/rtext/frontend/connector.rb +122 -55
  7. data/lib/rtext/instantiator.rb +11 -3
  8. data/lib/rtext/service.rb +264 -260
  9. metadata +18 -44
  10. data/Rakefile +0 -46
  11. data/test/completer_test.rb +0 -607
  12. data/test/context_builder_test.rb +0 -949
  13. data/test/frontend/context_test.rb +0 -302
  14. data/test/instantiator_test.rb +0 -1733
  15. data/test/integration/backend.out +0 -16
  16. data/test/integration/crash_on_request_editor.rb +0 -12
  17. data/test/integration/ecore_editor.rb +0 -50
  18. data/test/integration/frontend.log +0 -40058
  19. data/test/integration/model/invalid_encoding.invenc +0 -2
  20. data/test/integration/model/test.crash_on_request +0 -18
  21. data/test/integration/model/test.crashing_backend +0 -18
  22. data/test/integration/model/test.dont_open_socket +0 -0
  23. data/test/integration/model/test.invalid_cmd_line +0 -0
  24. data/test/integration/model/test.not_in_rtext +0 -0
  25. data/test/integration/model/test_large_with_errors.ect3 +0 -43523
  26. data/test/integration/model/test_metamodel.ect +0 -24
  27. data/test/integration/model/test_metamodel2.ect +0 -5
  28. data/test/integration/model/test_metamodel3.ect4 +0 -7
  29. data/test/integration/model/test_metamodel_error.ect2 +0 -3
  30. data/test/integration/model/test_metamodel_ok.ect2 +0 -18
  31. data/test/integration/test.rb +0 -968
  32. data/test/link_detector_test.rb +0 -288
  33. data/test/message_helper_test.rb +0 -117
  34. data/test/rtext_test.rb +0 -11
  35. data/test/serializer_test.rb +0 -1024
  36. data/test/tokenizer_test.rb +0 -174
@@ -1,302 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
-
3
- gem 'minitest'
4
- require 'minitest/autorun'
5
- require 'rtext/frontend/context'
6
-
7
- class ContextTest < MiniTest::Test
8
-
9
- def test_simple
10
- assert_context(
11
- %Q(
12
- A {
13
- B {
14
- |F bla
15
- ),
16
- %Q(
17
- A {
18
- B {
19
- C a1: v1, a2: "v2"
20
- D {
21
- E a1: 5
22
- }
23
- |F bla
24
- ))
25
- end
26
-
27
- def test_child_label
28
- assert_context(
29
- %Q(
30
- A {
31
- sub:
32
- B {
33
- F bla|
34
- ),
35
- %Q(
36
- A {
37
- sub:
38
- B {
39
- C a1: v1, a2: "v2"
40
- D {
41
- E a1: 5
42
- }
43
- F bla|
44
- ))
45
- end
46
-
47
- def test_child_label_array
48
- assert_context(
49
- %Q(
50
- A {
51
- sub: [
52
- B {
53
- F| bla
54
- ),
55
- %Q(
56
- A {
57
- sub: [
58
- B {
59
- C
60
- }
61
- B {
62
- C a1: v1, a2: "v2"
63
- D {
64
- E a1: 5
65
- }
66
- F| bla
67
- ))
68
- end
69
-
70
- def test_child_label_array2
71
- assert_context(
72
- %Q(
73
- A {
74
- B |
75
- ),
76
- %Q(
77
- A {
78
- sub: [
79
- ]
80
- B |
81
- ))
82
- end
83
-
84
- def test_child_label_array3
85
- assert_context(
86
- %Q(
87
- A {
88
- sub: [
89
- ] |
90
- ),
91
- %Q(
92
- A {
93
- sub: [
94
- ] |
95
- ))
96
- end
97
-
98
-
99
- def test_ignore_child_lables
100
- assert_context(
101
- %Q(
102
- A {
103
- B {
104
- F bl|a
105
- ),
106
- %Q(
107
- A {
108
- B {
109
- sub:
110
- C a1: v1, a2: "v2"
111
- sub2: [
112
- D {
113
- E a1: 5
114
- }
115
- ]
116
- F bl|a
117
- ))
118
- end
119
-
120
- def test_linebreak
121
- assert_context(
122
- %Q(
123
- A {
124
- B {
125
- C name, a1: v1, a2: "v2"|
126
- ),
127
- %Q(
128
- A {
129
- B {
130
- C name,
131
- a1: v1,
132
- a2: "v2"|
133
- ))
134
- end
135
-
136
- def test_linebreak_arg_array
137
- assert_context(
138
- %Q(
139
- A {
140
- B {
141
- C name, a1: [ v1, v2 ], a2: |5
142
- ),
143
- %Q(
144
- A {
145
- B {
146
- C name,
147
- a1: [
148
- v1,
149
- v2
150
- ],
151
- a2: |5
152
- ))
153
- end
154
-
155
- def test_linebreak_empty_last_line
156
- assert_context(
157
- %Q(
158
- A {
159
- B name, |
160
- ),
161
- %Q(
162
- A {
163
- B name,
164
- |
165
- ))
166
- end
167
-
168
- def test_linebreak_empty_last_line2
169
- assert_context(
170
- %Q(
171
- A {
172
- B name, |
173
- ),
174
- %Q(
175
- A {
176
- B name,
177
- |
178
- ))
179
- end
180
-
181
- def test_linebreak_empty_lines
182
- assert_context(
183
- %Q(
184
- A {
185
- B name, a1: |
186
- ),
187
- %Q(
188
- A {
189
- B name,
190
-
191
- a1: |
192
- ))
193
- end
194
-
195
- def test_linebreak_first_arg_array
196
- assert_context(
197
- %Q(
198
- A {
199
- B [ |
200
- ),
201
- %Q(
202
- A {
203
- B [
204
- |
205
- ))
206
- end
207
-
208
- def test_linebreak_first_arg_array2
209
- assert_context(
210
- %Q(
211
- A {
212
- B [ 2, |
213
- ),
214
- %Q(
215
- A {
216
- B [
217
- 2,
218
- |
219
- ))
220
- end
221
-
222
- def test_linebreak_first_arg_array3
223
- assert_context(
224
- %Q(
225
- A {
226
- B [ 2 ], |
227
- ),
228
- %Q(
229
- A {
230
- B [
231
- 2
232
- ], |
233
- ))
234
- end
235
-
236
- def test_linebreak_backslash
237
- assert_context(
238
- %Q(
239
- A {
240
- B arg: 1,|
241
- ),
242
- %Q(
243
- A {
244
- B \\
245
- arg: 1,|
246
- ))
247
- end
248
-
249
- def test_linebreak_whitespace_after_backslash
250
- assert_context(
251
- %Q(
252
- A {
253
- B arg: 1,|
254
- ),
255
- %Q(
256
- A {
257
- B \\
258
- arg: 1,|
259
- ))
260
- end
261
-
262
- def test_comment_annotation
263
- assert_context(
264
- %Q(
265
- A {
266
- B {
267
- |F bla
268
- ),
269
- %Q(
270
- A {
271
- # bla
272
- B {
273
- C a1: v1, a2: "v2"
274
- # bla
275
- D {
276
- E a1: 5
277
- }
278
- @ anno
279
- |F bla
280
- ))
281
- end
282
-
283
- def assert_context(expected, text)
284
- # remove first and last lines
285
- # these are empty because of the use of %Q
286
- exp_lines = expected.split("\n")[1..-2]
287
- exp_col = exp_lines.last.index("|")
288
- exp_lines.last.sub!("|","")
289
- in_lines = text.split("\n")[1..-2]
290
- in_col = in_lines.last.index("|")
291
- in_lines.last.sub!("|","")
292
- ctx = RText::Frontend::Context.new
293
- lines, out_col = ctx.extract(in_lines, in_col)
294
- assert_equal exp_lines, lines
295
- if exp_col && in_col
296
- assert_equal exp_col, out_col
297
- end
298
- end
299
-
300
- end
301
-
302
-