rubinius-melbourne 2.0.1.0 → 2.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +2 -9
  4. data/Gemfile +0 -4
  5. data/Rakefile +26 -19
  6. data/ext/rubinius/melbourne/extconf.rb +4 -3
  7. data/ext/rubinius/melbourne/grammar.cpp +2 -2
  8. data/ext/rubinius/melbourne/grammar.y +2 -2
  9. data/ext/rubinius/melbourne/melbourne.cpp +4 -5
  10. data/lib/rubinius/melbourne/version.rb +2 -2
  11. data/lib/rubinius/melbourne.rb +1 -21
  12. data/rubinius-melbourne.gemspec +6 -3
  13. data/spec/alias_spec.rb +13 -18
  14. data/spec/and_spec.rb +6 -12
  15. data/spec/array_spec.rb +28 -54
  16. data/spec/attrasgn_spec.rb +60 -85
  17. data/spec/back_ref_spec.rb +6 -8
  18. data/spec/call_spec.rb +137 -225
  19. data/spec/case_spec.rb +94 -112
  20. data/spec/cdecl_spec.rb +16 -28
  21. data/spec/class_spec.rb +28 -40
  22. data/spec/colon2_spec.rb +2 -4
  23. data/spec/colon3_spec.rb +2 -4
  24. data/spec/const_spec.rb +2 -4
  25. data/spec/custom/runner/relates.rb +4 -0
  26. data/spec/cvar_spec.rb +6 -12
  27. data/spec/cvasgn_spec.rb +20 -15
  28. data/spec/defined_spec.rb +57 -55
  29. data/spec/defn_spec.rb +218 -280
  30. data/spec/defs_spec.rb +30 -38
  31. data/spec/dot2_spec.rb +2 -4
  32. data/spec/dot3_spec.rb +2 -4
  33. data/spec/dregx_spec.rb +20 -34
  34. data/spec/dstr_spec.rb +87 -111
  35. data/spec/dsym_spec.rb +5 -7
  36. data/spec/dxstr_spec.rb +2 -4
  37. data/spec/ensure_spec.rb +32 -40
  38. data/spec/false_spec.rb +2 -4
  39. data/spec/flip2_spec.rb +22 -26
  40. data/spec/flip3_spec.rb +15 -17
  41. data/spec/for_spec.rb +25 -23
  42. data/spec/gasgn_spec.rb +4 -8
  43. data/spec/gvar_spec.rb +8 -16
  44. data/spec/hash_spec.rb +14 -18
  45. data/spec/iasgn_spec.rb +8 -14
  46. data/spec/if_spec.rb +50 -80
  47. data/spec/iter_spec.rb +328 -402
  48. data/spec/lasgn_spec.rb +143 -200
  49. data/spec/lit_spec.rb +20 -40
  50. data/spec/masgn_spec.rb +278 -309
  51. data/spec/match2_spec.rb +6 -10
  52. data/spec/match3_spec.rb +9 -13
  53. data/spec/match_spec.rb +2 -4
  54. data/spec/module_spec.rb +12 -16
  55. data/spec/nil_spec.rb +2 -4
  56. data/spec/not_spec.rb +6 -8
  57. data/spec/nth_ref_spec.rb +2 -4
  58. data/spec/op_asgn_spec.rb +118 -158
  59. data/spec/or_spec.rb +18 -24
  60. data/spec/postexe_spec.rb +2 -4
  61. data/spec/regex_spec.rb +11 -19
  62. data/spec/rescue_spec.rb +135 -143
  63. data/spec/return_spec.rb +19 -36
  64. data/spec/sclass_spec.rb +26 -25
  65. data/spec/spec_helper.rb +9 -0
  66. data/spec/str_spec.rb +25 -43
  67. data/spec/super_spec.rb +31 -49
  68. data/spec/true_spec.rb +2 -4
  69. data/spec/undef_spec.rb +38 -53
  70. data/spec/until_spec.rb +13 -105
  71. data/spec/valias_spec.rb +2 -4
  72. data/spec/while_spec.rb +35 -117
  73. data/spec/xstr_spec.rb +2 -4
  74. data/spec/yield_spec.rb +22 -42
  75. data/spec/zsuper_spec.rb +8 -16
  76. metadata +64 -22
  77. data/spec/cvdecl_spec.rb +0 -12
data/spec/lasgn_spec.rb CHANGED
@@ -1,85 +1,63 @@
1
1
  describe "An Lasgn node" do
2
- relates "a = 1" do
3
- parse do
4
- [:lasgn, :a, [:lit, 1]]
5
- end
2
+ parse "a = 1" do
3
+ [:lasgn, :a, [:lit, 1]]
6
4
  end
7
5
 
8
- relates "a = b, c, *d" do
9
- parse do
10
- [:lasgn,
11
- :a,
12
- [:svalue,
13
- [:array,
14
- [:call, nil, :b, [:arglist]],
15
- [:call, nil, :c, [:arglist]],
16
- [:splat, [:call, nil, :d, [:arglist]]]]]]
17
- end
6
+ parse "a = b, c, *d" do
7
+ [:lasgn,
8
+ :a,
9
+ [:argscat,
10
+ [:array, [:call, nil, :b, [:arglist]], [:call, nil, :c, [:arglist]]],
11
+ [:call, nil, :d, [:arglist]]]]
18
12
  end
19
13
 
20
- relates "a = [b, *c]" do
21
- parse do
22
- [:lasgn,
23
- :a,
24
- [:array,
25
- [:call, nil, :b, [:arglist]],
26
- [:splat, [:call, nil, :c, [:arglist]]]]]
27
- end
14
+ parse "a = [b, *c]" do
15
+ [:lasgn,
16
+ :a,
17
+ [:argscat,
18
+ [:array, [:call, nil, :b, [:arglist]]],
19
+ [:call, nil, :c, [:arglist]]]]
28
20
  end
29
21
 
30
- relates <<-ruby do
22
+ parse <<-ruby do
31
23
  x = (y = 1
32
24
  (y + 2))
33
25
  ruby
34
26
 
35
- parse do
36
- [:lasgn,
37
- :x,
38
- [:block,
39
- [:lasgn, :y, [:lit, 1]],
40
- [:call, [:lvar, :y], :+, [:arglist, [:lit, 2]]]]]
41
- end
27
+ [:lasgn,
28
+ :x,
29
+ [:block,
30
+ [:lasgn, :y, [:lit, 1]],
31
+ [:call, [:lvar, :y], :+, [:arglist, [:lit, 2]]]]]
42
32
  end
43
33
 
44
- relates <<-ruby do
34
+ parse <<-ruby do
45
35
  a = []
46
36
  a [42]
47
37
  ruby
48
38
 
49
- parse do
50
- [:block,
51
- [:lasgn, :a, [:array]],
52
- [:call, [:lvar, :a], :[], [:arglist, [:lit, 42]]]]
53
- end
54
-
55
- # call index space
39
+ [:block,
40
+ [:lasgn, :a, [:array]],
41
+ [:call, [:lvar, :a], :[], [:arglist, [:lit, 42]]]]
56
42
  end
57
43
 
58
- relates 'var = ["foo", "bar"]' do
59
- parse do
60
- [:lasgn, :var, [:array, [:str, "foo"], [:str, "bar"]]]
61
- end
44
+ parse 'var = ["foo", "bar"]' do
45
+ [:lasgn, :var, [:array, [:str, "foo"], [:str, "bar"]]]
62
46
  end
63
47
 
64
- relates "c = (2 + 3)" do
65
- parse do
66
- [:lasgn, :c, [:call, [:lit, 2], :+, [:arglist, [:lit, 3]]]]
67
- end
48
+ parse "c = (2 + 3)" do
49
+ [:lasgn, :c, [:call, [:lit, 2], :+, [:arglist, [:lit, 3]]]]
68
50
  end
69
51
 
70
- relates "a = *[1]" do
71
- parse do
72
- [:lasgn, :a, [:svalue, [:splat, [:array, [:lit, 1]]]]]
73
- end
52
+ parse "a = *[1]" do
53
+ [:lasgn, :a, [:splat, [:array, [:lit, 1]]]]
74
54
  end
75
55
 
76
- relates "a = *b" do
77
- parse do
78
- [:lasgn, :a, [:svalue, [:splat, [:call, nil, :b, [:arglist]]]]]
79
- end
56
+ parse "a = *b" do
57
+ [:lasgn, :a, [:splat, [:call, nil, :b, [:arglist]]]]
80
58
  end
81
59
 
82
- relates <<-ruby do
60
+ parse <<-ruby do
83
61
  a = if c
84
62
  begin
85
63
  b
@@ -90,169 +68,145 @@ describe "An Lasgn node" do
90
68
  a
91
69
  ruby
92
70
 
93
- parse do
94
- [:block,
95
- [:lasgn,
96
- :a,
97
- [:if,
98
- [:call, nil, :c, [:arglist]],
99
- [:rescue, [:call, nil, :b, [:arglist]], [:resbody, [:array], [:nil]]],
100
- nil]],
101
- [:lvar, :a]]
102
- end
71
+ [:block,
72
+ [:lasgn,
73
+ :a,
74
+ [:if,
75
+ [:call, nil, :c, [:arglist]],
76
+ [:rescue,
77
+ [:call, nil, :b, [:arglist]],
78
+ [:resbody, [:array, [:const, :StandardError]], [:nil]]],
79
+ nil]],
80
+ [:lvar, :a]]
103
81
  end
104
82
 
105
- relates "x = [*[1]]" do
106
- parse do
107
- [:lasgn, :x, [:array, [:splat, [:array, [:lit, 1]]]]]
108
- end
83
+ parse "x = [*[1]]" do
84
+ [:lasgn, :x, [:splat, [:array, [:lit, 1]]]]
109
85
  end
110
86
 
111
- relates "a = []" do
112
- parse do
113
- [:lasgn, :a, [:array]]
114
- end
87
+ parse "a = []" do
88
+ [:lasgn, :a, [:array]]
115
89
  end
116
90
 
117
- relates <<-ruby do
91
+ parse <<-ruby do
118
92
  a = 12
119
93
  a
120
94
  ruby
121
95
 
122
- parse do
123
- [:block, [:lasgn, :a, [:lit, 12]], [:lvar, :a]]
124
- end
96
+ [:block, [:lasgn, :a, [:lit, 12]], [:lvar, :a]]
125
97
  end
126
98
 
127
- relates <<-ruby do
99
+ parse <<-ruby do
128
100
  name
129
101
  name = 3
130
102
  name
131
103
  ruby
132
104
 
133
- parse do
134
- [:block,
135
- [:call, nil, :name, [:arglist]],
136
- [:lasgn, :name, [:lit, 3]],
137
- [:lvar, :name]]
138
- end
105
+ [:block,
106
+ [:call, nil, :name, [:arglist]],
107
+ [:lasgn, :name, [:lit, 3]],
108
+ [:lvar, :name]]
139
109
  end
140
110
 
141
- relates "a=12; b=13; true" do
142
- parse do
143
- [:block, [:lasgn, :a, [:lit, 12]], [:lasgn, :b, [:lit, 13]], [:true]]
144
- end
111
+ parse "a=12; b=13; true" do
112
+ [:block, [:lasgn, :a, [:lit, 12]], [:lasgn, :b, [:lit, 13]], [:true]]
145
113
  end
146
114
 
147
- relates <<-ruby do
115
+ parse <<-ruby do
148
116
  def f
149
117
  a = 1
150
118
  end
151
119
  ruby
152
120
 
153
- parse do
154
- [:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
155
- end
121
+ [:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
156
122
  end
157
123
 
158
- relates <<-ruby do
124
+ parse <<-ruby do
159
125
  def f(a)
160
126
  a = 1
161
127
  end
162
128
  ruby
163
129
 
164
- parse do
165
- [:defn, :f, [:args, :a], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
166
- end
130
+ [:defn, :f, [:args, :a], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
167
131
  end
168
132
 
169
- relates <<-ruby do
133
+ parse <<-ruby do
170
134
  def f
171
135
  b { a = 1 }
172
136
  end
173
137
  ruby
174
138
 
175
- parse do
176
- [:defn,
177
- :f,
178
- [:args],
179
- [:scope,
180
- [:block,
181
- [:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 1]]]]]]
182
- end
139
+ [:defn,
140
+ :f,
141
+ [:args],
142
+ [:scope,
143
+ [:block,
144
+ [:call, nil, :b, [:arglist, [:iter, [:args], [:lasgn, :a, [:lit, 1]]]]]]]]
183
145
  end
184
146
 
185
- relates <<-ruby do
147
+ parse <<-ruby do
186
148
  def f(a)
187
149
  b { a = 2 }
188
150
  end
189
151
  ruby
190
152
 
191
- parse do
192
- [:defn,
193
- :f,
194
- [:args, :a],
195
- [:scope,
196
- [:block,
197
- [:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 2]]]]]]
198
- end
153
+ [:defn,
154
+ :f,
155
+ [:args, :a],
156
+ [:scope,
157
+ [:block,
158
+ [:call, nil, :b, [:arglist, [:iter, [:args], [:lasgn, :a, [:lit, 2]]]]]]]]
199
159
  end
200
160
 
201
- relates <<-ruby do
161
+ parse <<-ruby do
202
162
  def f
203
163
  a = 1
204
164
  b { a = 2 }
205
165
  end
206
166
  ruby
207
167
 
208
- parse do
209
- [:defn,
210
- :f,
211
- [:args],
212
- [:scope,
213
- [:block,
214
- [:lasgn, :a, [:lit, 1]],
215
- [:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 2]]]]]]
216
- end
168
+ [:defn,
169
+ :f,
170
+ [:args],
171
+ [:scope,
172
+ [:block,
173
+ [:lasgn, :a, [:lit, 1]],
174
+ [:call, nil, :b, [:arglist, [:iter, [:args], [:lasgn, :a, [:lit, 2]]]]]]]]
217
175
  end
218
176
 
219
- relates <<-ruby do
177
+ parse <<-ruby do
220
178
  def f
221
179
  a
222
180
  b { a = 1 }
223
181
  end
224
182
  ruby
225
183
 
226
- parse do
227
- [:defn,
228
- :f,
229
- [:args],
230
- [:scope,
231
- [:block,
232
- [:call, nil, :a, [:arglist]],
233
- [:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 1]]]]]]
234
- end
184
+ [:defn,
185
+ :f,
186
+ [:args],
187
+ [:scope,
188
+ [:block,
189
+ [:call, nil, :a, [:arglist]],
190
+ [:call, nil, :b, [:arglist, [:iter, [:args], [:lasgn, :a, [:lit, 1]]]]]]]]
235
191
  end
236
192
 
237
- relates <<-ruby do
193
+ parse <<-ruby do
238
194
  def f
239
195
  b { a = 1 }
240
196
  a
241
197
  end
242
198
  ruby
243
199
 
244
- parse do
245
- [:defn,
246
- :f,
247
- [:args],
248
- [:scope,
249
- [:block,
250
- [:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 1]]],
251
- [:call, nil, :a, [:arglist]]]]]
252
- end
200
+ [:defn,
201
+ :f,
202
+ [:args],
203
+ [:scope,
204
+ [:block,
205
+ [:call, nil, :b, [:arglist, [:iter, [:args], [:lasgn, :a, [:lit, 1]]]]],
206
+ [:call, nil, :a, [:arglist]]]]]
253
207
  end
254
208
 
255
- relates <<-ruby do
209
+ parse <<-ruby do
256
210
  def f
257
211
  a = 1
258
212
  b { a = 2 }
@@ -260,58 +214,53 @@ describe "An Lasgn node" do
260
214
  end
261
215
  ruby
262
216
 
263
- parse do
264
- [:defn,
265
- :f,
266
- [:args],
267
- [:scope,
268
- [:block,
269
- [:lasgn, :a, [:lit, 1]],
270
- [:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 2]]],
271
- [:lvar, :a]]]]
272
- end
217
+ [:defn,
218
+ :f,
219
+ [:args],
220
+ [:scope,
221
+ [:block,
222
+ [:lasgn, :a, [:lit, 1]],
223
+ [:call, nil, :b, [:arglist, [:iter, [:args], [:lasgn, :a, [:lit, 2]]]]],
224
+ [:lvar, :a]]]]
273
225
  end
274
226
 
275
- relates <<-ruby do
227
+ parse <<-ruby do
276
228
  class F
277
229
  a = 1
278
230
  end
279
231
  ruby
280
232
 
281
- parse do
282
- [:class, :F, nil, [:scope, [:lasgn, :a, [:lit, 1]]]]
283
- end
233
+ [:class, :F, nil, [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
284
234
  end
285
235
 
286
- relates <<-ruby do
236
+ parse <<-ruby do
287
237
  a = Object
288
238
  class a::F
289
239
  b = 1
290
240
  end
291
241
  ruby
292
242
 
293
- parse do
294
- [:block,
295
- [:lasgn, :a, [:const, :Object]],
296
- [:class, [:colon2, [:lvar, :a], :F], nil, [:scope, [:lasgn, :b, [:lit, 1]]]]]
297
- end
243
+ [:block,
244
+ [:lasgn, :a, [:const, :Object]],
245
+ [:class,
246
+ [:colon2, [:lvar, :a], :F],
247
+ nil,
248
+ [:scope, [:block, [:lasgn, :b, [:lit, 1]]]]]]
298
249
  end
299
250
 
300
- relates <<-ruby do
251
+ parse <<-ruby do
301
252
  a = Object
302
253
  class F < a
303
254
  b = 1
304
255
  end
305
256
  ruby
306
257
 
307
- parse do
308
- [:block,
309
- [:lasgn, :a, [:const, :Object]],
310
- [:class, :F, [:lvar, :a], [:scope, [:lasgn, :b, [:lit, 1]]]]]
311
- end
258
+ [:block,
259
+ [:lasgn, :a, [:const, :Object]],
260
+ [:class, :F, [:lvar, :a], [:scope, [:block, [:lasgn, :b, [:lit, 1]]]]]]
312
261
  end
313
262
 
314
- relates <<-ruby do
263
+ parse <<-ruby do
315
264
  class F
316
265
  a = 1
317
266
  def f
@@ -320,29 +269,25 @@ describe "An Lasgn node" do
320
269
  end
321
270
  ruby
322
271
 
323
- parse do
324
- [:class,
325
- :F,
326
- nil,
327
- [:scope,
328
- [:block,
329
- [:lasgn, :a, [:lit, 1]],
330
- [:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]]]]
331
- end
272
+ [:class,
273
+ :F,
274
+ nil,
275
+ [:scope,
276
+ [:block,
277
+ [:lasgn, :a, [:lit, 1]],
278
+ [:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]]]]
332
279
  end
333
280
 
334
- relates <<-ruby do
281
+ parse <<-ruby do
335
282
  module M
336
283
  a = 1
337
284
  end
338
285
  ruby
339
286
 
340
- parse do
341
- [:module, :M, [:scope, [:lasgn, :a, [:lit, 1]]]]
342
- end
287
+ [:module, :M, [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
343
288
  end
344
289
 
345
- relates <<-ruby do
290
+ parse <<-ruby do
346
291
  module M
347
292
  a = 1
348
293
  def f
@@ -351,27 +296,25 @@ describe "An Lasgn node" do
351
296
  end
352
297
  ruby
353
298
 
354
- parse do
355
- [:module,
356
- :M,
357
- [:scope,
358
- [:block,
359
- [:lasgn, :a, [:lit, 1]],
360
- [:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]]]]
361
- end
299
+ [:module,
300
+ :M,
301
+ [:scope,
302
+ [:block,
303
+ [:lasgn, :a, [:lit, 1]],
304
+ [:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]]]]
362
305
  end
363
306
 
364
- relates <<-ruby do
307
+ parse <<-ruby do
365
308
  a = Object
366
309
  module a::M
367
310
  b = 1
368
311
  end
369
312
  ruby
370
313
 
371
- parse do
372
- [:block,
373
- [:lasgn, :a, [:const, :Object]],
374
- [:module, [:colon2, [:lvar, :a], :M], [:scope, [:lasgn, :b, [:lit, 1]]]]]
375
- end
314
+ [:block,
315
+ [:lasgn, :a, [:const, :Object]],
316
+ [:module,
317
+ [:colon2, [:lvar, :a], :M],
318
+ [:scope, [:block, [:lasgn, :b, [:lit, 1]]]]]]
376
319
  end
377
320
  end