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,174 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
-
3
- gem 'minitest'
4
- require 'minitest/autorun'
5
- require 'rtext/tokenizer'
6
- require 'rtext/generic'
7
-
8
- class TokenizerTest < MiniTest::Test
9
- include RText::Tokenizer
10
-
11
- def test_simple
12
- assert_tokens [
13
- Token.new(:identifier, "TestNode", 1, 1, 8),
14
- Token.new(:integer, 1, 1, 10, 10),
15
- Token.new(",", nil, 1, 11, 11),
16
- Token.new(:identifier, "bla", 1, 13, 15),
17
- Token.new(",", nil, 1, 16, 16),
18
- Token.new(:float, 0.4, 1, 18, 20),
19
- Token.new(",", nil, 1, 21, 21),
20
- Token.new(:label, "label", 1, 23, 28),
21
- Token.new(:integer, 4, 1, 30, 30),
22
- Token.new(",", nil, 1, 31, 31),
23
- Token.new(:string, "string", 1, 33, 40),
24
- Token.new(:newline, nil, 1, nil, nil)
25
- ], "TestNode 1, bla, 0.4, label: 4, \"string\""
26
- end
27
-
28
- def test_more
29
- assert_tokens [
30
- Token.new(:identifier, "TestNode", 1, 1, 8),
31
- Token.new(:boolean, true, 1, 10, 13),
32
- Token.new(",", nil, 1, 14, 14),
33
- Token.new(:integer, 0xfaa, 1, 16, 20),
34
- Token.new(:integer, -3, 1, 22, 23),
35
- Token.new(:reference, "/a/b", 1, 25, 28),
36
- Token.new(:newline, nil, 1, nil, nil)
37
- ], <<-END
38
- TestNode true, 0xfaa -3 /a/b
39
- END
40
- end
41
-
42
- def test_comments_and_annotation
43
- assert_tokens [
44
- Token.new(:comment, " comment", 1, 1, 9),
45
- Token.new(:newline, nil, 1, nil, nil),
46
- Token.new(:annotation, " annotation", 2, 1, 12),
47
- Token.new(:newline, nil, 2, nil, nil),
48
- Token.new(:identifier, "TestNode", 3, 1, 8),
49
- Token.new(:comment, "comment2", 3, 10, 18),
50
- Token.new(:newline, nil, 3, nil, nil)
51
- ], <<-END
52
- # comment
53
- @ annotation
54
- TestNode #comment2
55
- END
56
- end
57
-
58
- def test_generic
59
- tokens = do_tokenize("<name>")
60
- assert_equal :generic, tokens.first.kind
61
- assert_equal "name", tokens.first.value.string
62
- assert_equal 1, tokens.first.line
63
- assert_equal 1, tokens.first.scol
64
- assert_equal 6, tokens.first.ecol
65
- end
66
-
67
- def test_generic_bad
68
- tokens = do_tokenize("<a>b>")
69
- assert_equal :generic, tokens.first.kind
70
- assert_equal "a", tokens.first.value.string
71
- assert_equal 1, tokens.first.line
72
- assert_equal 1, tokens.first.scol
73
- assert_equal 3, tokens.first.ecol
74
- assert_equal :identifier, tokens[1].kind
75
- assert_equal :error, tokens[2].kind
76
- end
77
-
78
- def test_generic_percent
79
- tokens = do_tokenize("<%name%>")
80
- assert_equal :generic, tokens.first.kind
81
- assert_equal "name", tokens.first.value.string
82
- assert_equal 1, tokens.first.line
83
- assert_equal 1, tokens.first.scol
84
- assert_equal 8, tokens.first.ecol
85
- end
86
-
87
- def test_generic_percent_angle_close
88
- tokens = do_tokenize("<% a > b < c %>")
89
- assert_equal :generic, tokens.first.kind
90
- assert_equal " a > b < c ", tokens.first.value.string
91
- assert_equal 1, tokens.first.line
92
- assert_equal 1, tokens.first.scol
93
- assert_equal 15, tokens.first.ecol
94
- end
95
-
96
- def test_generic_percent_bad
97
- tokens = do_tokenize("<%= a %> b %>")
98
- assert_equal :generic, tokens.first.kind
99
- assert_equal "= a ", tokens.first.value.string
100
- assert_equal 1, tokens.first.line
101
- assert_equal 1, tokens.first.scol
102
- assert_equal 8, tokens.first.ecol
103
- assert_equal :identifier, tokens[1].kind
104
- assert_equal :error, tokens[2].kind
105
- end
106
-
107
- def test_error
108
- assert_tokens [
109
- Token.new(:error, "\"", 1, 1, 1),
110
- Token.new(:identifier, "open", 1, 2, 5),
111
- Token.new(:newline, nil, 1, nil, nil)
112
- ], <<-END
113
- "open
114
- END
115
- end
116
-
117
- def test_with_bom
118
- assert_tokens [
119
- Token.new(:identifier, "TestNode", 1, 1, 8),
120
- Token.new(:integer, 1, 1, 10, 10),
121
- Token.new(:newline, nil, 1, nil, nil)
122
- ], "\xEF\xBB\xBFTestNode 1"
123
- end
124
-
125
- def test_excessive_newline
126
- assert_tokens [
127
- Token.new(:identifier, "TestNode", 3, 1, 8),
128
- Token.new(:newline, nil, 3, nil, nil),
129
- Token.new(:identifier, "TestNode", 5, 1, 8),
130
- Token.new(:newline, nil, 5, nil, nil)
131
- ], %Q(
132
-
133
- TestNode
134
-
135
- TestNode
136
-
137
- )
138
- end
139
-
140
- def test_only_newline
141
- assert_tokens [
142
- ], %Q(
143
-
144
-
145
- )
146
- end
147
-
148
- def test_linebreak
149
- assert_tokens [
150
- Token.new(:identifier, "TestNode", 2, 1, 8),
151
- Token.new(:identifier, "someNode", 2, 10, 17),
152
- Token.new(",", nil, 2, 18, 18),
153
- Token.new(:newline, nil, 2, nil, nil),
154
- Token.new(:label, "label", 3, 3, 8),
155
- Token.new(:identifier, "x", 3, 10, 10),
156
- Token.new(:newline, nil, 3, nil, nil),
157
- ], %Q(
158
- TestNode someNode,
159
- label: x
160
- )
161
-
162
- end
163
-
164
- def do_tokenize(str)
165
- tokenize(str, /\A\/[\/\w]+/)
166
- end
167
-
168
- def assert_tokens(expected, str)
169
- tokens = tokenize(str, /\A\/[\/\w]+/)
170
- assert_equal(expected, tokens)
171
- end
172
-
173
- end
174
-