rtext 0.8.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +113 -84
  3. data/Project.yaml +14 -0
  4. data/RText_Protocol +47 -4
  5. data/lib/rtext/context_builder.rb +49 -8
  6. data/lib/rtext/default_completer.rb +212 -163
  7. data/lib/rtext/default_service_provider.rb +3 -3
  8. data/lib/rtext/frontend/connector.rb +122 -55
  9. data/lib/rtext/frontend/context.rb +12 -12
  10. data/lib/rtext/instantiator.rb +11 -3
  11. data/lib/rtext/language.rb +5 -5
  12. data/lib/rtext/serializer.rb +1 -1
  13. data/lib/rtext/service.rb +264 -253
  14. data/lib/rtext/tokenizer.rb +1 -1
  15. metadata +18 -43
  16. data/Rakefile +0 -46
  17. data/test/completer_test.rb +0 -606
  18. data/test/context_builder_test.rb +0 -948
  19. data/test/frontend/context_test.rb +0 -205
  20. data/test/instantiator_test.rb +0 -1691
  21. data/test/integration/backend.out +0 -13
  22. data/test/integration/crash_on_request_editor.rb +0 -12
  23. data/test/integration/ecore_editor.rb +0 -50
  24. data/test/integration/frontend.log +0 -36049
  25. data/test/integration/model/invalid_encoding.invenc +0 -2
  26. data/test/integration/model/test.crash_on_request +0 -18
  27. data/test/integration/model/test.crashing_backend +0 -18
  28. data/test/integration/model/test.dont_open_socket +0 -0
  29. data/test/integration/model/test.invalid_cmd_line +0 -0
  30. data/test/integration/model/test.not_in_rtext +0 -0
  31. data/test/integration/model/test_large_with_errors.ect3 +0 -43523
  32. data/test/integration/model/test_metamodel.ect +0 -24
  33. data/test/integration/model/test_metamodel2.ect +0 -5
  34. data/test/integration/model/test_metamodel_error.ect2 +0 -3
  35. data/test/integration/model/test_metamodel_ok.ect2 +0 -18
  36. data/test/integration/test.rb +0 -918
  37. data/test/link_detector_test.rb +0 -287
  38. data/test/message_helper_test.rb +0 -118
  39. data/test/rtext_test.rb +0 -11
  40. data/test/serializer_test.rb +0 -1004
  41. data/test/tokenizer_test.rb +0 -173
@@ -1,205 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),"..","..","lib")
2
-
3
- require 'test/unit'
4
- require 'rtext/frontend/context'
5
-
6
- class ContextTest < Test::Unit::TestCase
7
-
8
- def test_simple
9
- assert_context(
10
- %Q(
11
- A {
12
- B {
13
- |F bla
14
- ),
15
- %Q(
16
- A {
17
- B {
18
- C a1: v1, a2: "v2"
19
- D {
20
- E a1: 5
21
- }
22
- |F bla
23
- ))
24
- end
25
-
26
- def test_child_label
27
- assert_context(
28
- %Q(
29
- A {
30
- sub:
31
- B {
32
- F bla|
33
- ),
34
- %Q(
35
- A {
36
- sub:
37
- B {
38
- C a1: v1, a2: "v2"
39
- D {
40
- E a1: 5
41
- }
42
- F bla|
43
- ))
44
- end
45
-
46
- def test_child_label_array
47
- assert_context(
48
- %Q(
49
- A {
50
- sub: [
51
- B {
52
- F| bla
53
- ),
54
- %Q(
55
- A {
56
- sub: [
57
- B {
58
- C
59
- }
60
- B {
61
- C a1: v1, a2: "v2"
62
- D {
63
- E a1: 5
64
- }
65
- F| bla
66
- ))
67
- end
68
-
69
- def test_ignore_child_lables
70
- assert_context(
71
- %Q(
72
- A {
73
- B {
74
- F bl|a
75
- ),
76
- %Q(
77
- A {
78
- B {
79
- sub:
80
- C a1: v1, a2: "v2"
81
- sub2: [
82
- D {
83
- E a1: 5
84
- }
85
- ]
86
- F bl|a
87
- ))
88
- end
89
-
90
- def test_linebreak
91
- assert_context(
92
- %Q(
93
- A {
94
- B {
95
- C name,a1: v1,a2: "v2"|
96
- ),
97
- %Q(
98
- A {
99
- B {
100
- C name,
101
- a1: v1,
102
- a2: "v2"|
103
- ))
104
- end
105
-
106
- def test_linebreak_arg_array
107
- assert_context(
108
- %Q(
109
- A {
110
- B {
111
- C name,a1: [v1,v2],a2: |5
112
- ),
113
- %Q(
114
- A {
115
- B {
116
- C name,
117
- a1: [
118
- v1,
119
- v2
120
- ],
121
- a2: |5
122
- ))
123
- end
124
-
125
- def test_linebreak_empty_last_line
126
- assert_context(
127
- %Q(
128
- A {
129
- B name,|
130
- ),
131
- %Q(
132
- A {
133
- B name,
134
- |
135
- ))
136
- end
137
-
138
- def test_linebreak_empty_last_line2
139
- assert_context(
140
- %Q(
141
- A {
142
- B name,|
143
- ),
144
- %Q(
145
- A {
146
- B name,
147
- |
148
- ))
149
- end
150
-
151
- def test_linebreak_empty_lines
152
- assert_context(
153
- %Q(
154
- A {
155
- B name,a1: |
156
- ),
157
- %Q(
158
- A {
159
- B name,
160
-
161
- a1: |
162
- ))
163
- end
164
-
165
- def test_comment_annotation
166
- assert_context(
167
- %Q(
168
- A {
169
- B {
170
- |F bla
171
- ),
172
- %Q(
173
- A {
174
- # bla
175
- B {
176
- C a1: v1, a2: "v2"
177
- # bla
178
- D {
179
- E a1: 5
180
- }
181
- @ anno
182
- |F bla
183
- ))
184
- end
185
-
186
- def assert_context(expected, text)
187
- # remove first and last lines
188
- # these are empty because of the use of %Q
189
- exp_lines = expected.split("\n")[1..-2]
190
- exp_col = exp_lines.last.index("|")
191
- exp_lines.last.sub!("|","")
192
- in_lines = text.split("\n")[1..-2]
193
- in_col = in_lines.last.index("|")
194
- in_lines.last.sub!("|","")
195
- ctx = RText::Frontend::Context.new
196
- lines, out_col = ctx.extract(in_lines, in_col)
197
- assert_equal exp_lines, lines
198
- if exp_col && in_col
199
- assert_equal exp_col, out_col
200
- end
201
- end
202
-
203
- end
204
-
205
-