kuniri 0.0.1

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.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +43 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +18 -0
  5. data/.yardopts +1 -0
  6. data/COPYING +661 -0
  7. data/Gemfile +14 -0
  8. data/Guardfile +8 -0
  9. data/README.md +102 -0
  10. data/Rakefile +114 -0
  11. data/bin/kuniri +53 -0
  12. data/data/attribute_lang.rb +131 -0
  13. data/data/class_lang.rb +77 -0
  14. data/data/conditional_lang.rb +71 -0
  15. data/data/constructor_lang.rb +34 -0
  16. data/data/end_block_lang.rb +30 -0
  17. data/data/extern_requirement_lang.rb +45 -0
  18. data/data/function_behavior_lang.rb +113 -0
  19. data/data/lang_syntax.rb +111 -0
  20. data/data/module_namespace_lang.rb +43 -0
  21. data/data/repetition_lang.rb +62 -0
  22. data/data/token_lang.rb +55 -0
  23. data/data/variable_global_lang.rb +118 -0
  24. data/kuniri.gemspec +24 -0
  25. data/lib/kuniri/core/configuration/language_available.rb +7 -0
  26. data/lib/kuniri/core/configuration/log_available.rb +7 -0
  27. data/lib/kuniri/core/configuration/monitor_available.rb +13 -0
  28. data/lib/kuniri/core/kuniri.rb +78 -0
  29. data/lib/kuniri/core/setting.rb +143 -0
  30. data/lib/kuniri/error/configuration_file_error.rb +12 -0
  31. data/lib/kuniri/error/language_error.rb +12 -0
  32. data/lib/kuniri/language/abstract_container/structured_and_oo/attribute.rb +73 -0
  33. data/lib/kuniri/language/abstract_container/structured_and_oo/class.rb +51 -0
  34. data/lib/kuniri/language/abstract_container/structured_and_oo/comment.rb +57 -0
  35. data/lib/kuniri/language/abstract_container/structured_and_oo/conditional.rb +42 -0
  36. data/lib/kuniri/language/abstract_container/structured_and_oo/constructor.rb +52 -0
  37. data/lib/kuniri/language/abstract_container/structured_and_oo/end_block.rb +27 -0
  38. data/lib/kuniri/language/abstract_container/structured_and_oo/extern_requirement.rb +36 -0
  39. data/lib/kuniri/language/abstract_container/structured_and_oo/function_behavior.rb +55 -0
  40. data/lib/kuniri/language/abstract_container/structured_and_oo/module_namespace.rb +36 -0
  41. data/lib/kuniri/language/abstract_container/structured_and_oo/repetition.rb +42 -0
  42. data/lib/kuniri/language/abstract_container/structured_and_oo/variable_behaviour.rb +53 -0
  43. data/lib/kuniri/language/abstract_container/structured_and_oo/variable_global.rb +67 -0
  44. data/lib/kuniri/language/container_data/structured_and_oo/attribute_data.rb +26 -0
  45. data/lib/kuniri/language/container_data/structured_and_oo/basic_data.rb +18 -0
  46. data/lib/kuniri/language/container_data/structured_and_oo/class_data.rb +77 -0
  47. data/lib/kuniri/language/container_data/structured_and_oo/conditional_data.rb +23 -0
  48. data/lib/kuniri/language/container_data/structured_and_oo/constructor_data.rb +18 -0
  49. data/lib/kuniri/language/container_data/structured_and_oo/extern_requirement_data.rb +26 -0
  50. data/lib/kuniri/language/container_data/structured_and_oo/file_element.rb +77 -0
  51. data/lib/kuniri/language/container_data/structured_and_oo/function_abstract.rb +52 -0
  52. data/lib/kuniri/language/container_data/structured_and_oo/function_data.rb +21 -0
  53. data/lib/kuniri/language/container_data/structured_and_oo/method_data.rb +20 -0
  54. data/lib/kuniri/language/container_data/structured_and_oo/module_namespace_data.rb +18 -0
  55. data/lib/kuniri/language/container_data/structured_and_oo/repetition_data.rb +23 -0
  56. data/lib/kuniri/language/container_data/structured_and_oo/variable_global_data.rb +22 -0
  57. data/lib/kuniri/language/language.rb +222 -0
  58. data/lib/kuniri/language/language_factory.rb +48 -0
  59. data/lib/kuniri/language/ruby/attribute_ruby.rb +134 -0
  60. data/lib/kuniri/language/ruby/class_ruby.rb +83 -0
  61. data/lib/kuniri/language/ruby/comment_ruby.rb +84 -0
  62. data/lib/kuniri/language/ruby/conditional_ruby.rb +77 -0
  63. data/lib/kuniri/language/ruby/constructor_ruby.rb +36 -0
  64. data/lib/kuniri/language/ruby/end_block_ruby.rb +33 -0
  65. data/lib/kuniri/language/ruby/extern_requirement_ruby.rb +49 -0
  66. data/lib/kuniri/language/ruby/function_behavior_ruby.rb +120 -0
  67. data/lib/kuniri/language/ruby/module_namespace_ruby.rb +47 -0
  68. data/lib/kuniri/language/ruby/repetition_ruby.rb +68 -0
  69. data/lib/kuniri/language/ruby/ruby_syntax.rb +117 -0
  70. data/lib/kuniri/language/ruby/token_ruby.rb +59 -0
  71. data/lib/kuniri/language/ruby/variable_behaviour_ruby.rb +83 -0
  72. data/lib/kuniri/language/ruby/variable_global_ruby.rb +123 -0
  73. data/lib/kuniri/parser/parser.rb +45 -0
  74. data/lib/kuniri/parser/parser_xml.rb +128 -0
  75. data/lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb +51 -0
  76. data/lib/kuniri/state_machine/OO_structured_fsm/class_state.rb +94 -0
  77. data/lib/kuniri/state_machine/OO_structured_fsm/comment_state.rb +76 -0
  78. data/lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb +92 -0
  79. data/lib/kuniri/state_machine/OO_structured_fsm/constructor_state.rb +71 -0
  80. data/lib/kuniri/state_machine/OO_structured_fsm/function_state.rb +82 -0
  81. data/lib/kuniri/state_machine/OO_structured_fsm/idle_state.rb +80 -0
  82. data/lib/kuniri/state_machine/OO_structured_fsm/include_state.rb +59 -0
  83. data/lib/kuniri/state_machine/OO_structured_fsm/method_state.rb +69 -0
  84. data/lib/kuniri/state_machine/OO_structured_fsm/module_state.rb +79 -0
  85. data/lib/kuniri/state_machine/OO_structured_fsm/oo_structured_state.rb +92 -0
  86. data/lib/kuniri/state_machine/OO_structured_fsm/repetition_state.rb +85 -0
  87. data/lib/kuniri/state_machine/OO_structured_fsm/token_state_machine.rb +8 -0
  88. data/lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb +49 -0
  89. data/lib/kuniri/util/html_logger.rb +41 -0
  90. data/lib/kuniri/util/logger.rb +34 -0
  91. data/lib/kuniri/util/txt_logger.rb +29 -0
  92. data/lib/kuniri/version.rb +3 -0
  93. data/lib/kuniri.rb +5 -0
  94. data/other/analyseFile.asta +0 -0
  95. data/spec/core/kuniri_spec.rb +14 -0
  96. data/spec/core/setting_spec.rb +114 -0
  97. data/spec/language/abstract_container/attribute_spec.rb +13 -0
  98. data/spec/language/abstract_container/class_spec.rb +13 -0
  99. data/spec/language/abstract_container/comment_spec.rb +31 -0
  100. data/spec/language/abstract_container/conditional_spec.rb +13 -0
  101. data/spec/language/abstract_container/constructor_spec.rb +13 -0
  102. data/spec/language/abstract_container/end_block_spec.rb +14 -0
  103. data/spec/language/abstract_container/module_namespace_spec.rb +13 -0
  104. data/spec/language/abstract_container/repetition_spec.rb +13 -0
  105. data/spec/language/container_data/structured_and_oo/attribute_data_spec.rb +32 -0
  106. data/spec/language/container_data/structured_and_oo/class_data_spec.rb +121 -0
  107. data/spec/language/container_data/structured_and_oo/conditional_data_spec.rb +34 -0
  108. data/spec/language/container_data/structured_and_oo/constructor_data_spec.rb +46 -0
  109. data/spec/language/container_data/structured_and_oo/extern_requirement_data_spec.rb +26 -0
  110. data/spec/language/container_data/structured_and_oo/file_element_spec.rb +91 -0
  111. data/spec/language/container_data/structured_and_oo/function_data_spec.rb +22 -0
  112. data/spec/language/container_data/structured_and_oo/module_namespace_spec.rb +20 -0
  113. data/spec/language/container_data/structured_and_oo/repetition_data_spec.rb +34 -0
  114. data/spec/language/container_data/structured_and_oo/variable_global_data_spec.rb +39 -0
  115. data/spec/language/language_factory_spec.rb +64 -0
  116. data/spec/language/language_spec.rb +74 -0
  117. data/spec/language/ruby/attribute_ruby_spec.rb +126 -0
  118. data/spec/language/ruby/class_ruby_spec.rb +102 -0
  119. data/spec/language/ruby/comment_ruby_spec.rb +78 -0
  120. data/spec/language/ruby/conditional_ruby_spec.rb +106 -0
  121. data/spec/language/ruby/constructor_ruby_spec.rb +57 -0
  122. data/spec/language/ruby/end_block_ruby_spec.rb +62 -0
  123. data/spec/language/ruby/function_behavior_ruby_spec.rb +246 -0
  124. data/spec/language/ruby/module_namespace_ruby_spec.rb +55 -0
  125. data/spec/language/ruby/repetition_ruby_spec.rb +33 -0
  126. data/spec/language/ruby/ruby_syntax_spec.rb +482 -0
  127. data/spec/language/ruby/variable_ruby_spec.rb +134 -0
  128. data/spec/parser/parser_spec.rb +25 -0
  129. data/spec/samples/rubySyntaxParts/attribute/simpleAttribute.rb +15 -0
  130. data/spec/samples/rubySyntaxParts/class/simpleClass.rb +19 -0
  131. data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_class.rb +33 -0
  132. data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_global.rb +20 -0
  133. data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_class.rb +23 -0
  134. data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_global.rb +16 -0
  135. data/spec/samples/rubySyntaxParts/conditionalStatment/constructorConditional.rb +28 -0
  136. data/spec/samples/rubySyntaxParts/conditionalStatment/methodConditional.rb +42 -0
  137. data/spec/samples/rubySyntaxParts/conditionalStatment/nestedConditional.rb +0 -0
  138. data/spec/samples/rubySyntaxParts/conditionalStatment/simpleConditional.rb +43 -0
  139. data/spec/samples/rubySyntaxParts/constructor/simpleConstructor.rb +27 -0
  140. data/spec/samples/rubySyntaxParts/extern/multipleLineExternRequirement.rb +0 -0
  141. data/spec/samples/rubySyntaxParts/extern/requireRelative.rb +6 -0
  142. data/spec/samples/rubySyntaxParts/extern/simpleExternRequirement.rb +14 -0
  143. data/spec/samples/rubySyntaxParts/fullCode/simpleCodeWithConditional.rb +18 -0
  144. data/spec/samples/rubySyntaxParts/fullCode/simpleFullCode.rb +19 -0
  145. data/spec/samples/rubySyntaxParts/function/simpleFunction.rb +29 -0
  146. data/spec/samples/rubySyntaxParts/method/simpleMethod.rb +13 -0
  147. data/spec/samples/rubySyntaxParts/module/simpleModule.rb +12 -0
  148. data/spec/samples/rubySyntaxParts/repetition/simpleRepetition.rb +28 -0
  149. data/spec/samples/rubySyntaxParts/variable/simpleVariable.rb +13 -0
  150. data/spec/spec_helper.rb +20 -0
  151. data/spec/state_machine/OO_structured_fsm/attribute_state_spec.rb +44 -0
  152. data/spec/state_machine/OO_structured_fsm/class_state_spec.rb +90 -0
  153. data/spec/state_machine/OO_structured_fsm/comment_state_spec.rb +30 -0
  154. data/spec/state_machine/OO_structured_fsm/conditional_state_spec.rb +83 -0
  155. data/spec/state_machine/OO_structured_fsm/constructor_state_spec.rb +48 -0
  156. data/spec/state_machine/OO_structured_fsm/function_state_spec.rb +41 -0
  157. data/spec/state_machine/OO_structured_fsm/idle_state_spec.rb +101 -0
  158. data/spec/state_machine/OO_structured_fsm/include_state_spec.rb +62 -0
  159. data/spec/state_machine/OO_structured_fsm/method_state_spec.rb +42 -0
  160. data/spec/state_machine/OO_structured_fsm/module_state_spec.rb +54 -0
  161. data/spec/state_machine/OO_structured_fsm/oo_structured_state_spec.rb +0 -0
  162. data/spec/state_machine/OO_structured_fsm/repetition_state_spec.rb +83 -0
  163. data/spec/state_machine/OO_structured_fsm/variable_state_spec.rb +40 -0
  164. data/spec/util/html_logger_spec.rb +31 -0
  165. data/spec/util/logger_spec.rb +20 -0
  166. data/spec/util/txt_logger_spec.rb +31 -0
  167. metadata +326 -0
@@ -0,0 +1,62 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe Languages::Ruby::EndBlockRuby do
4
+
5
+ before :all do
6
+ @endBlock = Languages::Ruby::EndBlockRuby.new
7
+ end
8
+
9
+ context "When the end of block is isolate in one line." do
10
+ it "No end in the line" do
11
+ isEnd = @endBlock.has_end_of_block?("class Xpto")
12
+ expect(isEnd).to eq(false)
13
+ end
14
+
15
+ it "Find simple situation of end." do
16
+ isEnd = @endBlock.has_end_of_block?("end")
17
+ expect(isEnd).to eq(true)
18
+ end
19
+
20
+ it "Find end of block with spaces in the begin." do
21
+ isEnd = @endBlock.has_end_of_block?(" end")
22
+ expect(isEnd).to eq(true)
23
+ isEnd = @endBlock.has_end_of_block?(" end")
24
+ expect(isEnd).to eq(true)
25
+ isEnd = @endBlock.has_end_of_block?(" end")
26
+ expect(isEnd).to eq(true)
27
+ end
28
+
29
+ it "Find end of block with space after." do
30
+ isEnd = @endBlock.has_end_of_block?("end ")
31
+ expect(isEnd).to eq(true)
32
+ isEnd = @endBlock.has_end_of_block?("end ")
33
+ expect(isEnd).to eq(true)
34
+ isEnd = @endBlock.has_end_of_block?("end ")
35
+ expect(isEnd).to eq(true)
36
+ end
37
+
38
+ it "Find end of block with space in the begin and in the end." do
39
+ isEnd = @endBlock.has_end_of_block?(" end ")
40
+ expect(isEnd).to eq(true)
41
+ isEnd = @endBlock.has_end_of_block?(" end ")
42
+ expect(isEnd).to eq(true)
43
+ isEnd = @endBlock.has_end_of_block?(" end ")
44
+ expect(isEnd).to eq(true)
45
+ isEnd = @endBlock.has_end_of_block?(" end ")
46
+ expect(isEnd).to eq(true)
47
+ isEnd = @endBlock.has_end_of_block?(" end ")
48
+ expect(isEnd).to eq(true)
49
+ end
50
+
51
+ end
52
+
53
+ #context "end in the same line of other instructions" do
54
+ # TODO: This is the hardest cases. Do it!
55
+ #end
56
+
57
+ after :all do
58
+ @endBlock = nil
59
+ end
60
+
61
+ end
62
+
@@ -0,0 +1,246 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe Languages::Ruby::FunctionBehaviorRuby do
4
+
5
+ before :all do
6
+ @functionBehaviorRuby = Languages::Ruby::FunctionBehaviorRuby.new
7
+ end
8
+
9
+ context "When method without parameters" do
10
+ it "Common declaration." do
11
+ input = "def xpto_method"
12
+ expect(@functionBehaviorRuby.get_function(input).name)
13
+ .to eq("xpto_method")
14
+ end
15
+
16
+ it "With whitespace in the beginning." do
17
+ input = " def xpto_method"
18
+ expect(@functionBehaviorRuby.get_function(input).name)
19
+ .to eq("xpto_method")
20
+ end
21
+
22
+ it "With whitespace at the end." do
23
+ input = "def xpto_method "
24
+ expect(@functionBehaviorRuby.get_function(input).name)
25
+ .to eq("xpto_method")
26
+ end
27
+
28
+ it "Between whitespace." do
29
+ input = " def xpto_method "
30
+ expect(@functionBehaviorRuby.get_function(input).name)
31
+ .to eq("xpto_method")
32
+ end
33
+
34
+ it "Whitespace between def and method name." do
35
+ input = "def xpto_method"
36
+ expect(@functionBehaviorRuby.get_function(input).name)
37
+ .to eq("xpto_method")
38
+ end
39
+
40
+ it "Whitespace in the beginning and between def." do
41
+ input = " def xpto_method"
42
+ expect(@functionBehaviorRuby.get_function(input).name)
43
+ .to eq("xpto_method")
44
+ end
45
+
46
+ it "Whitespace between def and in the end." do
47
+ input = "def xpto_method "
48
+ expect(@functionBehaviorRuby.get_function(input).name)
49
+ .to eq("xpto_method")
50
+ end
51
+
52
+ it "Tab in the beginning and space in the end." do
53
+ input = " def xpto_method "
54
+ expect(@functionBehaviorRuby.get_function(input).name)
55
+ .to eq("xpto_method")
56
+ end
57
+
58
+ it "Whitespace in the beginning and in the end." do
59
+ input = " def xpto_method "
60
+ expect(@functionBehaviorRuby.get_function(input).name)
61
+ .to eq("xpto_method")
62
+ end
63
+
64
+ it "Many whitespace between def." do
65
+ input = " def xpto_method"
66
+ expect(@functionBehaviorRuby.get_function(input).name)
67
+ .to eq("xpto_method")
68
+ end
69
+
70
+ it "Whitespace in the beginning, between and in the end" do
71
+ input = " def xpto_method "
72
+ expect(@functionBehaviorRuby.get_function(input).name)
73
+ .to eq("xpto_method")
74
+ end
75
+ end
76
+
77
+ context "With parameters" do
78
+ it "Take method name" do
79
+ input = "def xpto_method(a, b, c, d)\n"
80
+ expect(@functionBehaviorRuby.get_function(input).name)
81
+ .to eq("xpto_method")
82
+ end
83
+
84
+ it "Whitespace in the beginning." do
85
+ input = " def xpto_method(a, b, c, d)\n"
86
+ expect(@functionBehaviorRuby.get_function(input).name)
87
+ .to eq("xpto_method")
88
+ end
89
+
90
+ it "Whitespace in the end." do
91
+ input = "def xpto_method(a, b, c, d) \n"
92
+ expect(@functionBehaviorRuby.get_function(input).name)
93
+ .to eq("xpto_method")
94
+ end
95
+
96
+ it "Between whitespace." do
97
+ input = " def xpto_method(a, b, c, d) \n"
98
+ expect(@functionBehaviorRuby.get_function(input).name)
99
+ .to eq("xpto_method")
100
+ end
101
+
102
+ it "Spaces between parameters." do
103
+ input = "def xpto_method (a, b, c, d)\n"
104
+ expect(@functionBehaviorRuby.get_function(input).name)
105
+ .to eq("xpto_method")
106
+ end
107
+
108
+ it "Many whitespace between method name and parameters." do
109
+ input = " def xpto_method (a, b, c, d)\n"
110
+ expect(@functionBehaviorRuby.get_function(input).name)
111
+ .to eq("xpto_method")
112
+ end
113
+
114
+ it "Many whitespace between method declaration." do
115
+ input = " def xpto_method ( a , b , c , d ) \n"
116
+ expect(@functionBehaviorRuby.get_function(input).name)
117
+ .to eq("xpto_method")
118
+ end
119
+
120
+ it "Different whitespace patterns." do
121
+ input = " def xpto_method ( a, b, c, d ) \n"
122
+ expect(@functionBehaviorRuby.get_function(input).name)
123
+ .to eq("xpto_method")
124
+ end
125
+ end
126
+
127
+ context "When has parameters and parenthesis." do
128
+ it "One parameter" do
129
+ input = "def xpto_method(a)"
130
+
131
+ methodOne = @functionBehaviorRuby.get_function(input)
132
+ expect(methodOne.parameters).to match_array(["a"])
133
+ end
134
+
135
+ it "Two parameters" do
136
+ input = "def xpto_method(a, b)"
137
+
138
+ methodOne = @functionBehaviorRuby.get_function(input)
139
+ expect(methodOne.parameters).to match_array(["a", "b"])
140
+ end
141
+
142
+ it "Three parameters" do
143
+ input = "def xpto_method(a, ab, abc)"
144
+
145
+ methodOne = @functionBehaviorRuby.get_function(input)
146
+ expect(methodOne.parameters).to match_array(["a", "ab", "abc"])
147
+ end
148
+
149
+ it "Three parameters, with whitespace." do
150
+ input = "def xpto_method (a, ab , abc) "
151
+
152
+ methodOne = @functionBehaviorRuby.get_function(input)
153
+ expect(methodOne.parameters).to match_array(["a", "ab", "abc"])
154
+ end
155
+
156
+
157
+ it "One parameter with assignment" do
158
+ input = "def xpto_method(a=3)"
159
+
160
+ methodOne = @functionBehaviorRuby.get_function(input)
161
+ expect(methodOne.parameters).to match_array([{"a"=>"3"}])
162
+ end
163
+
164
+ it "Two parameters with assignment" do
165
+ input = "def xpto_method(a=4, b=7)"
166
+
167
+ methodOne = @functionBehaviorRuby.get_function(input)
168
+ expect(methodOne.parameters).to match_array([{"a"=>"4"}, {"b"=>"7"}])
169
+ end
170
+
171
+ it "Parameters with whitespace between them." do
172
+ input = "def xpto_method(a=7, b=8, c = 0, d = 324)"
173
+
174
+ methodOne = @functionBehaviorRuby.get_function(input)
175
+ expect(methodOne.parameters).to match_array([{"a"=>"7"}, {"b"=>"8"},
176
+ {"c"=>"0"}, {"d"=>"324"}])
177
+ end
178
+
179
+ it "Parameters with whitespace between assignment." do
180
+ input = "def xpto_method(a = 7,b =8, c = 0,d = 324)"
181
+
182
+ methodOne = @functionBehaviorRuby.get_function(input)
183
+ expect(methodOne.parameters).to match_array([{"a"=>"7"}, {"b"=>"8"},
184
+ {"c"=>"0"}, {"d"=>"324"}])
185
+
186
+ end
187
+
188
+ it "No parameter, just parenthesis" do
189
+ input = "def xpto_method()"
190
+
191
+ methodOne = @functionBehaviorRuby.get_function(input)
192
+ expect(methodOne.parameters).to eq([])
193
+ end
194
+ end
195
+
196
+
197
+ context "When has parameters and no parenthesis." do
198
+ it "No parenthesis, and one parameter" do
199
+ input = "def xpto_method x"
200
+ methodOne = @functionBehaviorRuby.get_function(input)
201
+ expect(methodOne.parameters).to match_array(["x"])
202
+ end
203
+
204
+ it "One parameter, with space at the end." do
205
+ input = "def xpto_method x "
206
+ methodOne = @functionBehaviorRuby.get_function(input)
207
+ expect(methodOne.parameters).to match_array(["x"])
208
+ end
209
+
210
+ it "One parameter, with space in the end and in the begining." do
211
+ input = "def xpto_method x "
212
+ methodOne = @functionBehaviorRuby.get_function(input)
213
+ expect(methodOne.parameters).to match_array(["x"])
214
+ end
215
+
216
+ it "One parameter, multiple spaces" do
217
+ input = " def xpto_method x "
218
+ methodOne = @functionBehaviorRuby.get_function(input)
219
+ expect(methodOne.parameters).to match_array(["x"])
220
+ end
221
+
222
+ it "Two parameters" do
223
+ input = "def xpto_method x,y"
224
+ methodOne = @functionBehaviorRuby.get_function(input)
225
+ expect(methodOne.parameters).to match_array(["x", "y"])
226
+ end
227
+
228
+ it "Three parameters" do
229
+ input = "def xpto_method x, abcde, xyz"
230
+ methodOne = @functionBehaviorRuby.get_function(input)
231
+ expect(methodOne.parameters).to match_array(["x", "abcde", "xyz"])
232
+ end
233
+
234
+ it "Multiple parameters with many spaces" do
235
+ input = " def xpto_method x , m, nda , t "
236
+ methodOne = @functionBehaviorRuby.get_function(input)
237
+ expect(methodOne.parameters).to match_array(["x", "m", "nda", "t"])
238
+ end
239
+
240
+ end
241
+
242
+ after :all do
243
+ @functionBehaviorRuby = nil
244
+ end
245
+
246
+ end
@@ -0,0 +1,55 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe Languages::Ruby::ModuleNamespaceRuby do
4
+
5
+ before :all do
6
+ @modules = Languages::Ruby::ModuleNamespaceRuby.new
7
+ end
8
+
9
+ context "Common case of module declarations" do
10
+ it "Module on corner." do
11
+ capturedModule = @modules.get_module("module Abc")
12
+ expect(capturedModule.name).to eq("Abc")
13
+ end
14
+
15
+ it "Module with space before." do
16
+ capturedModule = @modules.get_module(" module Xpto")
17
+ expect(capturedModule.name).to eq("Xpto")
18
+ end
19
+
20
+ it "Module with space after." do
21
+ capturedModule = @modules.get_module("module TestOne ")
22
+ expect(capturedModule.name).to eq("TestOne")
23
+ end
24
+
25
+ it "Module with space after, and before." do
26
+ capturedModule = @modules.get_module(" module BeforeAfter ")
27
+ expect(capturedModule.name).to eq("BeforeAfter")
28
+ end
29
+
30
+ it "Module with space between keyword and name." do
31
+ capturedModule = @modules.get_module("module SpaceBetween")
32
+ expect(capturedModule.name).to eq("SpaceBetween")
33
+ end
34
+
35
+ it "Module with space between keyword, and before." do
36
+ capturedModule =
37
+ @modules.get_module(" module SpaceBetweenBefore")
38
+ expect(capturedModule.name).to eq("SpaceBetweenBefore")
39
+ end
40
+
41
+ it "Module with space before keyword, and after." do
42
+ capturedModule = @modules.get_module("module SpaceBetweenAfter ")
43
+ expect(capturedModule.name).to eq("SpaceBetweenAfter")
44
+ end
45
+
46
+ it "Module with space before keyword, between, and after" do
47
+ capturedModule = @modules.get_module(" module BeforeBetweenAfter ")
48
+ expect(capturedModule.name).to eq("BeforeBetweenAfter")
49
+ end
50
+ end
51
+
52
+ after :all do
53
+ @module = nil
54
+ end
55
+ end
@@ -0,0 +1,33 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ RSpec.describe Languages::Ruby::RepetitionRuby do
4
+
5
+ before :each do
6
+ @repetitionRuby = Languages::Ruby::RepetitionRuby.new
7
+ end
8
+
9
+ context "When it is if statment." do
10
+ it "Simple if statment." do
11
+ input = "while gets do"
12
+ repetitionCaptured = @repetitionRuby.get_repetition(input).expression
13
+ expect(repetitionCaptured).to eq("gets")
14
+
15
+ input = "while 2 < 3 do"
16
+ repetitionCaptured = @repetitionRuby.get_repetition(input).expression
17
+ expect(repetitionCaptured).to eq("2 < 3")
18
+
19
+ #input = "for x.range(0,1)"
20
+ #repetitionCaptured = @repetitionRuby.get_repetition(input).expression
21
+ #expect(repetitionCaptured).to eq("x.range(0,1)")
22
+
23
+ input = "while x == 222222 do"
24
+ repetitionCaptured = @repetitionRuby.get_repetition(input).expression
25
+ expect(repetitionCaptured).to eq("x == 222222")
26
+ end
27
+ end
28
+
29
+ after :each do
30
+ @repetitionRuby = nil
31
+ end
32
+
33
+ end